PDA

View Full Version : java version different from javac



koba101
April 22nd, 2008, 05:43 PM
Hi,

When I type the version of javac in the terminal i get the following:



javac 1.6.0_03


However the java version is :


java version "1.5.0"
gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


So the complier is 1.6 yet the runtime it java5, how do i fix this?

Hallvor
April 22nd, 2008, 06:23 PM
Try this:


sudo update-java-alternatives

Hopefully you get to a screen where you can select the java version you want. Haven`t tested it myself...

crs0328
April 22nd, 2008, 07:18 PM
You might make sure you have java installed correctly through the Synaptic Package Manager.
sun-java5-jdk or sun-java6-jdk

Once you are sure you have the version of java you want to use installed, you need to match the java compiler to the correct version of java.

This will give you the choice to choose which version of java on your computer you want to use:

sudo update-alternatives --config java

This will give you a choice to choose which compiler you want to use. (i.e. version 1.5.0 or 1.6.0)

sudo update-alternatives --config javac

Once they are using the same java version, you should be set to go.

koba101
April 22nd, 2008, 09:07 PM
alright this worked out fine...just one thing...how do i uninstall java 5 since i already have java 6?

I'm actually having similar problems similar to this like having two versions of alsa...how can i remove those programs?

crs0328
April 25th, 2008, 05:45 PM
To uninstall java5, just use the Synaptic Package Manager. Search for sun-java5-jdk and it will remove itself and all the dependencies (of course after you hit apply). I'm not familiar with alsa, but I would assume you could uninstall it the same way.

SOULRiDER
April 25th, 2008, 05:50 PM
alright this worked out fine...just one thing...how do i uninstall java 5 since i already have java 6?

I'm actually having similar problems similar to this like having two versions of alsa...how can i remove those programs?

If you have the Sun JRE,

sudo aptitude remove sun-java5-jre
That however is not Java, its GNU's implementation of Java, im not sure what the package is called. Look for packages that begin with GCJ.