I am running Ubuntu 16.04. I have downloaded JDK 7.0 from Oracle website and untar'ed and put it in a folder /opt/JDK/
, such that the final install directory is /opt/JDK/jdk1.7.0_80
Then I executed the following commands given in this SO answer:
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0/bin/javac 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so 1
update-alternatives --set java /opt/jdk1.8.0/bin/java
update-alternatives --set javac /opt/jdk1.8.0/bin/javac
update-alternatives --set mozilla-javaplugin.so /opt/jdk1.8.0/jre/lib/amd64/libnpjp2.so
I want to set the JAVA_HOME
environment variable. I know how to do it using /etc/environment
. The confusion is which path to use.
Should I use /usr/bin/java
?
Or should I use /opt/JDK/jdk1.7.0_80
?
Or should I use /opt/JDK/jdk1.7.0_80/bin
?
The output of update-alternatives --config java
is:
There is 1 choice for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /opt/JDK/jdk1.7.0_80/bin/java 1 auto mode
* 1 /opt/JDK/jdk1.7.0_80/bin/java 1 manual mode
Press <enter> to keep the current choice[*], or type selection number: