Let me show you in this article how to do the Installation of the 64-bit JDK on any Linux Platforms, this installation was tested on my local virtual machime, but i assume that should be working on all kind of Linux Systems,
1-Download the installation tarball File:
Please endure that Wget packahe has been installed , else yu may Download manually the tarball directly from the Oracle website
cd /opt 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/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz"
2-extract the compssed file
tar xzf jdk-8u191-linux-x64.tar.gz
3- Install Java 8 with Alternatives
The alternatives command is used for maintained symbolic links. This command used to creates, removes, maintains and displays information about the symbolic links comprising the alternatives system.
cd /opt/jdk1.8.0_191/ alternatives --install /usr/bin/java java /opt/jdk1.8.0_191/bin/java 2 alternatives --config java
its showing 1 program which provide ‘java’. because only this last one release Command
At this point JAVA 8 has been successfully installed on mysystem. We recommend to setup javac and jar commands path using alternatives
alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_191/bin/jar 2 alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_191/bin/javac 2 alternatives --set jar /opt/jdk1.8.0_191/bin/jar alternatives --set javac /opt/jdk1.8.0_191/bin/javac
4 – Check Installed Java Version
Java and javac binaries are available under PATH environment variable. You can use them from anywhere in your system. Let’s check the installed version of Java runtime environment (JRE) on your system by executing the following command.
[root@osradar jdk1.8.0_191]# java -version java version "1.8.0_191" Java(TM) SE Runtime Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode) [root@osradar jdk1.8.0_191]#
5 – Setup Java Environment Variables
Most of Java based application’s uses environment variables to work. Set the Java environment variables usingthe commands
Set the PATH, JAVA_HOME, and JRE_HOME environment variables.
export JAVA_HOME=/opt/jdk1.8.0_191 export JRE_HOME=/opt/jdk1.8.0_191/jre export PATH=$PATH:/opt/jdk1.8.0_191/bin:/opt/jdk1.8.0_191/jre/bin
Also add the above commands to /etc/bashrc file to auto set environment variables on the system boot.