Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to change the java environment to java-6-openjdk.


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- while the $CLASSPATH is /usr/lib/jvm/java-6-sun-

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

share|improve this question

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

sudo update-alternatives --config java will automatically set all the environment variables where required. Check for more information. Hope this helps.

share|improve this answer
Doesn't work - doesn't set the environment variables – eggonlegs Jan 24 '14 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


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.