https://community.linuxmint.com/tutorial/view/1372
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# Download the 64-bit version if you have a 64-bit machine
Linux x64
# Check the md5 number with md5sum and compare it to the sum on the Oracle site
sha256sum jdk-8u121-linux-i586.tar.gz
tar xvf jdk-8u121-linux-i586.tar.gz
# Lets improve the installation process by setting the java version in a variable so the user can change the version in one place.
java_version=1.8.0_121
sudo mkdir jdk
sudo mv jdk$java_version /opt/java
# 8. Make JDK system default.
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk$java_version/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk$java_version/bin/java
# 9. Test installed java version.
$ java -version
java version "$java_version" Java(TM) SE Runtime Environment (build $java_version-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
# Optinaly install firefox plugin by linking libnpjp2.so file to ~/.mozzila/plugins folder.
mkdir -p ~/.mozzila/plugins
ln -s /opt/java/jdk$java_version/jre/lib/amd64/libnpjp2.so ~/.mozzila/plugins/
Make a symbolic link to point to the specific java version and reference the symbolic link in your .bashrc files. If you save your bashrc files in Dropbox or some other cloud provider and then link to the cloud version of the .bashrc files then the JAVA_HOME will always point to the symlink. This is important because if you use different computers they each might have a different version of Java 1.7 for example but JAVA_HOME will point to the symlink which will point to the Java version on the specific computer.
$ sudo mkdir /usr/lib/jvm
$ sudo ln -s /opt/java/jdk1.7.0_79/ /usr/lib/jvm/java-7-oracle
~/.bashrc:export JAVA_HOME="/usr/lib/jvm/java-7-oracle"
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# Download the 64-bit version if you have a 64-bit machine
Linux x64
# | 174.76 MB | jdk-8u121-linux-x64.tar.gz |
# Check the md5 number with md5sum and compare it to the sum on the Oracle site
sha256sum jdk-8u121-linux-i586.tar.gz
tar xvf jdk-8u121-linux-i586.tar.gz
# Lets improve the installation process by setting the java version in a variable so the user can change the version in one place.
java_version=1.8.0_121
sudo mkdir jdk
sudo mv jdk$java_version /opt/java
# 8. Make JDK system default.
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk$java_version/bin/java" 1
sudo update-alternatives --set java /opt/java/jdk$java_version/bin/java
# 9. Test installed java version.
$ java -version
java version "$java_version" Java(TM) SE Runtime Environment (build $java_version-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
# Optinaly install firefox plugin by linking libnpjp2.so file to ~/.mozzila/plugins folder.
mkdir -p ~/.mozzila/plugins
ln -s /opt/java/jdk$java_version/jre/lib/amd64/libnpjp2.so ~/.mozzila/plugins/
Make a symbolic link to point to the specific java version and reference the symbolic link in your .bashrc files. If you save your bashrc files in Dropbox or some other cloud provider and then link to the cloud version of the .bashrc files then the JAVA_HOME will always point to the symlink. This is important because if you use different computers they each might have a different version of Java 1.7 for example but JAVA_HOME will point to the symlink which will point to the Java version on the specific computer.
$ sudo mkdir /usr/lib/jvm
$ sudo ln -s /opt/java/jdk1.7.0_79/ /usr/lib/jvm/java-7-oracle
~/.bashrc:export JAVA_HOME="/usr/lib/jvm/java-7-oracle"