Step 1. Download the package.
Step 2. Create a directory named “jdk” under /opt/
jdk can have all the packages which are installed manually.
Step 3. Extract and keep the package under /opt/jdk
tar -zxf jdk-8u111-linux-i586.tar.gz -C /opt/jdk
Step 4. Set the path:
update-alternatives –install /usr/bin/java java /opt/jdk/jdk1.8.0_111/bin/java 100
update-alternatives –install /usr/bin/javac javac /opt/jdk/jdk1.8.0_111/bin/java 100
Step 5. Verification: Use following command to check if Java is installed properly or not.