Home / Linux  / Install Java 8 ( JDK 8u71) on RHEL 7 /CentOS 7 and Fedora

Install Java 8 ( JDK 8u71) on RHEL 7 /CentOS 7 and Fedora

redhat Linux Java install java Fedora Centos
Do us a favor with share this post ūüôā

Install  8  JDK   Version 8 Update 71  ( JDK 8u71) on RHEL/ and

This article explain you how to install and configure Java  JDK latest version  on CentOS /RHEL servers.

Here I am going to install latest Java JDK on  RHEL 7.1 Version . Below is my Red Hat Server information.

[[email protected]~]# cat /etc/-release    Red Hat Enterprise  Server release 7.1 (Maipo)

Downlod Java  JDK   Latest Version

Download  latest  Java SE  Development Kit  8  from  official Java vendor . Below are the steps for download the java  and extract in temporary folder in linux.

For  Linux x64 ( 64 Bit )

# cd /tmp    #  curl -LO  http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-x64.tar.gz  -H --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"    #tar xzf jdk-8u71-linux-x64.tar.gz
# mv jdk1.8.0_71/ /opt


For  Linux x86 ( 32 Bit )

#cd /tmp    # curl -LO  http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-i586.tar.gz  -H --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"
#tar xzf jdk-8u71-linux-i586.tar.gz    # mv jdk1.8.0_71/ /opt



Here we have –no-cookies and ¬†–header option with ¬†curl or wget because of oracle does not give download unless we have not accept their license or terms .for accept header and license use above syntax for download .

–no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie”

Install  Java

Now we have got extracted folder of java (jdk1.8.0_71). Alternatives command is the best way to . Go to the extracted folder of java and run like below command as showing.

   #cd /opt/jdk1.8.0_71    # alternatives --install /usr/bin/java java /opt/jdk1.8.0_71/bin/java 2  # alternatives --config java  There are 2 programs which provide 'java'.     Selection Command  -----------------------------------------------  *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java   2 /opt/jdk1.8.0_71/bin/java    Enter to keep the current selection[+], or type selection number: 2  

Now we can select the updated version of java. Now  we should set  jar and javac  path .

# alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_71/bin/jar 2    # alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_71/bin/javac 2     # alternatives --set jar /opt/jdk1.8.0_71/bin/jar    # alternatives --set javac /opt/jdk1.8.0_71/bin/javac


Set  Java Environment Variables :

After the set of javac and jre path , we will set the environment variables  in linux . So many application needs to use the JAVA_Home or JRE_HOME environment variables for java executable to use, even you can not  see java version without environment  variables set.

To set  java home variable use below command.

#export JAVA_HOME=/opt/jdk1.8.0_71

To set  jre home variable use below command

# export JRE_HOME=/opt/jdk1.8.0_71/jre/

To set the path variables use below command

#export PATH=$PATH:/opt/jdk1.8.0_71/bin:/opt/jdk1.8.0_71/jre/bin

Verify Installed Java Version

Now check the version of installed java on linux box through below command

[[email protected] ~]# java -version  java version "1.8.0_71"  Java(TM) SE Runtime Environment (build 1.8.0_51-b16)  Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)    

If your java command not running after set the environment variables then add below lines  in bashrc and profile files in /etc directory.

JAVA_HOME=/opt/jdk1.8.0_71/    export PATH=$JAVA_HOME/bin:$PATH


Congratulations, Now we have install , run and configure java !


Do us a favor with share this post ūüôā

A Linux Geek with Freelance Contributor, Server/ Cloud Administrator having 6+ Years experience in Open Source and Cloud Technologies.

Review overview

Sorry, the comment form is closed at this time.