LinTut

How to install Java 8 on RHEL/CentOS 7.x and Fedora Linux

In this tutorial I’ll try to explain to you how to install JAVA 8 (JDK 8u45) on RHEL/CentOS 6.x/7.x and Fedora 19/20/21/2x Linux.

Preparing to install Java 8

At the beginning you need to upgrade your system:

# yum update

Now, use the below command to check the installed Java version on your system:

# java -version
-bash: java: command not found

The error clearly shows that as of now I haven’t installed any Java software on my server.
If Java 1.6 or 1.7 have been installed already, you can uninstall them using the following commands.

# yum remove java-1.6.0-openjdk
# yum remove java-1.7.0-openjdk

Downloading Latest Java Archive

Use the below command to download the oracle java 8 rpm file. Make sure oracle uses cookies, so use according that. Its like the below format.

### For 32 bit
# 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.rpm"

### For 64 bit
# 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-x64.rpm"

Install Java 8 (jdk 8u45) on RHEL / CentOS / Fedora Linux

Use the below command to Install Oracle Java 8 (jdk-8u45) on your system using RPM file.

### For 32 bit
# rpm -ivh jdk-8u45-linux-i586.rpm

### For 64 bit 
# rpm -ivh jdk-8u45-linux-x64.rpm

Example output:

# rpm -ivh jdk-8u45-linux-x64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_45-2000:1.8.0_45-fcs    ################################# [100%]
Unpacking JAR files...
	rt.jar...
	jsse.jar...
	charsets.jar...
	tools.jar...
	localedata.jar...
	jfxrt.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...

Checking Installed java version

After finishing installation check Java version using below command:

# 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)

Thanks for reading this article. If you get this article helpful, please don’t forget to share it.

Exit mobile version