Download latest 64 bit Java SE Development Kit 8 release
1 2 3 4 5 6 |
# mkdir /opt/shared # cd /opt/shared # wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.tar.gz" # tar xzf jdk-8u66-linux-x64.tar.gz |
To download 32 bit Java 8
1 2 3 4 |
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-i586.tar.gz" # tar xzf jdk-8u66-linux-i586.tar.gz |
Install Java
1 2 3 4 |
# alternatives --install /usr/bin/java java /opt/shared/jdk1.8.0_66/bin/java 2 # alternatives --config java |
choose /opt/shared/jdk1.8.0_66/bin/java
Setup Jar and Java c (optional)
1 2 3 4 5 6 |
# alternatives --install /usr/bin/jar jar /opt/shared/jdk1.8.0_66/bin/jar 2 # alternatives --install /usr/bin/javac javac /opt/shared/jdk1.8.0_66/bin/javac 2 # alternatives --set jar /opt/shared/jdk1.8.0_66/bin/jar # alternatives --set javac /opt/shared/jdk1.8.0_66/bin/javac |
Configuring Environment Variables (if necessary)
it will auto load the settings
1 2 3 |
# vi /etc/environment |
add the following into the file
1 2 3 4 5 |
export JAVA_HOME=/opt/shared/jdk1.8.0_66 export JRE_HOME=/opt/shared/jdk1.8.0_66/jre export PATH=$PATH:/opt/shared/jdk1.8.0_66/bin:/opt/shared/jdk1.8.0_66/jre/bin |