Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to change the java environment to java-6-openjdk.
/etc/environment:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib

java -version:

java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.5) (6b20-1.9.5-0ubuntu1~10.04.1)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

javac -version:javac 1.6.0_20

But in the shell:
the echo $JAVA_HOME result is /usr/lib/jvm/java-6-sun-1.6.0.22 while the $CLASSPATH is /usr/lib/jvm/java-6-sun-1.6.0.22/lib.

How to find the other files in which $JAVA_HOME & $CLASSPATH value is setted by the java-6-sun-1.6.0.22 location?

share|improve this question

2 Answers 2

If you have more than 1 JREs in your system, you're supposed to select the default by running:

sudo update-alternatives --config java

...it will automatically set all the environment variables where required. Check https://help.ubuntu.com/community/JavaInstallation for more information. Hope this helps.

share|improve this answer
    
Doesn't work - doesn't set the environment variables –  eggonlegs Jan 24 at 1:59

In my system (Ubuntu 10.04.LTS) /usr/lib/jvm/java-1.6.0-openjdk is symbolic link pointed to /usr/lib/java-6-openjdk directory.

In /etc/environments JAVA_HOME refers the link only.

Maybe you check this link in your system.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.