1

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?

1

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.

  • what should the value for the variable JAVA_HOME be, then? – Thufir Apr 24 '17 at 17:29
  • 1
    For example: JAVA_HOME="/usr/lib/jvm/java-8-oracle" – ksimon Apr 25 '17 at 5:41
  • In quotes as PATH above? No quotes? On separate line is what I have. – Thufir Apr 25 '17 at 6:04
  • I copied from bash export list. In case of echo $JAVA_HOME, there is no quotes, only: /usr/lib/jvm/java-8-oracle – ksimon Apr 25 '17 at 7:00
1

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.

  • Doesn't work - doesn't set the environment variables – eggonlegs Jan 24 '14 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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