Using java in FC1(with eclipse)-help needed

Mark Eggers mdeggers at earthlink.net
Tue Mar 16 20:48:31 UTC 2004


On Tue, 2004-03-16 at 12:21, fedora-list-request at redhat.com 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.

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.

HTH
/mde/






More information about the users mailing list