Installation of JAVA 8 ( JDK 8u45) on Linux Systems

Installation of JAVA 8

Java 8 is known for cross platform availability developed by Sun Micro systems in 1995. It is fast, secure and reliable nature. Linux distribution comes with other version of Java called OpenJDK which is an open source implementation of Java application. Installation of JAVA 8 is explained in this manual.

 

To install Java 8 in Linux

To verify the version of installed Java

[root@linuxhelp~]# java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-2)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

 

To make a directory location to install Java

[root@linuxhelp~]# mkdir /opt/java && cd /opt/java

 

To download Java (JDK) 8u45

Download source tarball files for your system architecture from official Java download page.

The source tarball file-names are as follows

jdk-8u45-linux-i586.tar.gz [For 32-bit Systems]
jdk-8u45-linux-x64.tar.gz [For 64-bit Systems]

You can also use wget command to download files directly into the /opt/java directory.

--------------- For 32-bit Systems ---------------

[root@linuxhelp~]# cd /opt/java
[root@linuxhelp~]# 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/8u45-b14/jdk-8u45-linux-i586.tar.gz"


--------------- For 64-bit Systems --------------

[root@linuxhelp~]# cd /opt/java
[root@linuxhelp~]# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2

 

To extract the tarball

Use tar with zxvf options command to extract the tarball.

[root@linuxhelp~]# tar -zxvf jdk-8u45-linux-i586.tar.gz        [For 32-bit Systems]
[root@linuxhelp~]# tar -zxvf jdk-8u45-linux-x64.tar.gz        [For 64-bit Systems]

 

To move to the extracted directory

update-alternatives is the command used to move to the extracted directory.

[root@linuxhelp~]# cd jdk1.8.0_45/
[root@linuxhelp~]# update-alternatives --install /usr/bin/java java /opt/java/jdk1.8.0_45/bin/java 100  
[root@linuxhelp~]# update-alternatives --config java

 

To update javac (java compiler) alternatives

[root@linuxhelp~]# update-alternatives --install /usr/bin/javac javac /opt/java/jdk1.8.0_45/bin/javac 100
[root@linuxhelp~]# update-alternatives --config javac

 

To update jar alternatives

[root@linuxhelp~]# update-alternatives --install /usr/bin/jar jar /opt/java/jdk1.8.0_45/bin/jar 100
[root@linuxhelp~]# update-alternatives --config jar

 

To Set up Java Environment Variables

[root@linuxhelp~]# export JAVA_HOME=/opt/java/jdk1.8.0_45/    
[root@linuxhelp~]# export JRE_HOME=/opt/java/jdk1.8.0._45/jre     
[root@linuxhelp~]# export PATH=$PATH:/opt/java/jdk1.8.0_45/bin:/opt/java/jdk1.8.0_45/jre/bin

 

To verify the Java version

[root@linuxhelp~]# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

 if OpenJDK is not used then you can remove using the following command


[root@linuxhelp~]# apt-get remove openjdk-* 

Thank you! for using Linux Help.

You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website www.linuxhelp.com
Be the first to comment, we value your suggestions. For further queries please comment below.

Tags: Java
user image Author :  Jackson