Sponsored Content
Top Forums Programming Java not getting in expected way Post 303017941 by scriptor on Friday 25th of May 2018 07:08:42 AM
Old 05-25-2018
Java not getting in expected way

Hi

i am new to java and written a below code on linux platform which is working fine but not getting the output on terminal as expected
Code:
 
 vi A.java 
import java.io.FileOutputStream;
class A
{
public static void main (String args[])
{
byte[] c= {'a','e','i','o','u'};
try
{
FileOutputStream b =new FileOutputStream("/home/k");
b.write(65);
b.write(c,1,4);
b.getChannel();
b.close();
System.out.println("success");
System.out.println(b.getChannel());
System.out.println(b.getFD());
}
catch(Exception e)
{
System.out.println(e);
}
}
}

here i am getting below Output which is correct
Code:
[root@1s home]# cat k
Aeiou[root@1s home]#

but i want output as below. how should i get this. suggest the way forward.
Code:
[root@1s home]# cat k
Aeiou
[root@1s home]#

 

We Also Found This Discussion For You

1. Programming

Not getting O/P in expected way-java

through below code i am trying to write a content in a file and then reading the same file my code is running file but is not getting in proper way import java.io.*; class A1 { public static void main (String agrs) { byte b = {'a','e','i','o','u'}; String s = "King Maker"; try {... (7 Replies)
Discussion started by: scriptor
7 Replies
MAKE-JPKG(1)						      General Commands Manual						      MAKE-JPKG(1)

NAME
make-jpkg - builds Debian packages from Java binary distributions SYNOPSIS
make-jpkg [OPTION]... [FILE] DESCRIPTION
make-jpkg builds a Debian package from the given Java distribution FILE. Supported java binary distributions currently include: * Oracle (http://www.oracle.com/technetwork/java/javase/downloads) : - The J2SE Development Kit (JDK), version 6 (update >= 10), 7 - The J2SE Runtime Environment (JRE), version 6 (update >= 10), 7 - The J2SE API Javadoc, version 6 (update >= 10), 7 (Choose tar.gz archives or self-extracting archives, do _not_ choose the RPM!) The following options are recognized: --full-name NAME full name used in the maintainer field of the package --email EMAIL email address used in the maintainer field of the package --changes create a .changes file --revision add debian revision --help display help text and exit --version output version information and exit Download a supported Java RE or SDK or API tar.gz or self-extracting archive from http://www.oracle.com/technetwork/java/javase/downloads and execute make-jpkg file with the downloaded file. The program asks the user for additional information and builds a Debian binary pack- age in the current directory. The program requires about 200 MB free disk space in a temporary directory. The temporary directory defaults to /tmp but you can specify an alternate directory by setting the environment variable TMPDIR. EXAMPLE
To install Oracle(TM) 7 Standard Edition JDK, download a release - 64 bits version of update 2 from http://www.oracle.com/technet- work/java/javase/downloads/jdk-7u2-download-1377129.html in this example - and invoke make-jpkg: make-jpkg <path_to_download_directory>/jdk-7u2-linux-x64.tar.gz This generate a Debian package in the current directory, that can be installed using dpkg: dpkg -i oracle-j2sdk1.7_1.7.0+update2_amd64.deb When you're done, you can delete initial download as well as generated package: rm <path_to_download_directory>/jdk-7u2-linux-x64.tar.gz oracle-j2sdk1.7_1.7.0+update2_amd64.deb ENVIRONMENT
TMPDIR base directory used for temporary files (defaults to /tmp) J2SE_PACKAGE_FULL_NAME full name used in the maintainer field of the package; if none is supplied then the default of "Debian Java Maintainers" is used. J2SE_PACKAGE_EMAIL email address used in the maintainer field of the package; if none is supplied the default of "pkg-java-maintain- ers@lists.alioth.debian.org" is used. SEE ALSO
update-java-alternatives(1) AUTHOR
This manual page was written by Hubert Schmid <j2se-package@z42.de>. It is now maintained by the Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>. January 22, 2012 MAKE-JPKG(1)
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy