Re: Using java in FC1(with eclipse)-help needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gcj is the java compiler in the gnu suite.
gij is the java executable. What I have done is to link gij to a file called
java. Then when I type in java somejavabytecode file, I am actually
executing gij, but it runs the same. For gcj, it is a little more complex
in that the equivalent for javac is "gcj -C" (capital C) which tells gcj to
compile to byte code. There are other options to gcj that allow compilation
to OS specific binary codes. You have a few options here, which is to
alias javac to "gcj -C" or to create an executable shell script file called
javac which calls "gcj -C".


Michael Kearey wrote:

Mark Eggers wrote:

On Tue, 2004-03-16 at 12:21, fedora-list-request@xxxxxxxxxx wrote:



Kaustubh Ghosh wrote:



I am quite novice towards java programming in linux.To start with I installed j2re1.4.2_03 and also j2sdk1.4.2_04 in FC1(Both from java.sin.com).Now peculiar problems arise.
When I type "java -version" it gives 1.3.1(
When I type "/usr/java/j2sdk1.4.2_04/bin/java -version" it gives 1.4.2_04.
Anyway I can compile any .java file with javac.
But when I try to run it with java(any of the above) the gui would not come.(Hello World executes perfectly with System.out.println as also other non-gui programs).



You have both Sun's Java and GNU's Java installed. GNU's Java comes by default when you select all of the compilers during the install.


GNU's Java RPMS for Fedora do not include any 'java' executable. This is what gcc-java package has for executables:

/usr/bin/gcj
/usr/bin/gcjh
/usr/bin/jcf-dump
/usr/bin/jv-scan

And this is what libgcj has :

/usr/bin/gij
/usr/bin/grepjar
/usr/bin/jar
/usr/bin/jv-convert
/usr/bin/rmic
/usr/bin/rmiregistry

gij is the bytecode interpretor for GNU java - the equivalent of 'java' executable BTW.


I really don't know how you can be so convinced that the java -version that gives 1.3.1 is anything to do with GNU's java..



What I did was to find all the matching files in /usr that were supplied by Sun's J2SDK and moved them to a /usr/<directory>/orig. I then added my $JAVA_HOME/bin and $JAVA_HOME/jre/javaws to my PATH variable. javaws is where Java WebStart is located.

Like you, I have multiple Java versions installed.  I usually keep the
current release and the previous release around in case something breaks
in the current release that didn't break in the previous release.

To do this I make a symbolic link from where I installed Java to
/usr/java.

For example, if I have j2sdk1.4.2_02 and j2sdk1.4.2_04 installed in
/usr, I will link /usr/j2sdk1.4.2_04 to /usr/java.

I then set JAVA_HOME to /usr/java.

This arrangement seems to work reasonably well.  Another approach would
be to not make the link to /usr/java and just set the JAVA_HOME
environment variable appropriately.

However, in both cases you'll need to take the GNU commands out of your
path and make sure that you have the Sun-supplied versions in your path.


I'd do 'which java' to see the java executable that is found in path. Also do 'rpm -qa |grep j2' to see what, if any, RPMS are installed related to java 2...

Yes, and sort out the PATH to have the correct java executable needed..

Cheers,
Michael






[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux