1. Donload jdk package from Oracle:
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.tar.gz
2. Setop JDK Environmentsudo sumkdir /opt/jdk
tar -zxf jdk-8u40-linux-x64.tar.gz -C /opt/jdk
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_40/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_40/bin/javac 1003. Check Java Environment. To check the java environment, you just use this command:java –versionThe console will prompt message like this:
java version “1.8.0_40”
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)If you get the following message while using java commend:bash: /usr/bin/java: No such file or directoryThis problem is due to lack of libc6-i386 package. Use the following command to install it and then java can be run.sudo apt-get install libc6-i386
Reference
1. Digital Ocean.com , "How To Manually Install Oracle Java on a Debian or Ubuntu VPS", Digital Ocean Community. Available: [Online] https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps