solution
-
reference
-
steps
-
check java version
$ java -version
-
remove openjdk/jre
$ sudo apt-get purge openjdk-\*
-
copy jdk-7u79-linux-x64.tar.gz to /usr/local/java
$ sudo cp -r jdk-7u79-linux-x64.tar.gz /usr/local/java
-
unpack
$ sudo tar zxf jdk-7u79-linux-x64.tar.gz
-
double-check
$ ls -a jdk1.7.0_79
-
edit /etc/profile
# at the end of file $ pico /etc/profile JAVA_HOME=/usr/local/java/jdk1.7.0_79 JRE_HOME=$JAVA_HOME/jre PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin export JAVA_HOME export JRE_HOME export PATH
-
inform os where oracle jdk/jre located
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_79/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_79/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.7.0_79/bin/javaws" 1
-
inform os that oracle jdk/jre is default java
$ sudo update-alternatives --set java /usr/local/java/jdk1.7.0_79/bin/java $ sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_79/bin/javac $ sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_79/bin/javaws
-
reload system wide PATH
$ . /etc/profile $ java -version
-
reboot
$ sudo reboot
-