Install Java 8 on CentOS/Fedora/RHEL

Install Java 8
Java is a high-level, class-based, object-oriented programming language . This article will help you to know how to install JAVA 8 on CentOS/Fedora/RHEL.

I hope our Java 7 installation tutorial was helpful to you. So after Java 7, here is our easy tutorial on installing Java 8 in your CentOS/Fedora/RHEL system.

 

1) Download the Source Package

You can download the latest Java 8 packages from here ( At the time of writing, the newest version is JDK 8u25, so that we will be installing that version ).

For 32 Bit :

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/8u25-b17/jdk-8u25-linux-i586.tar.gz"

 

For 64 Bit :

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/8u25-b17/jdk-8u25-linux-x64.tar.gz"

 

2) Extract the archive file

For 32 Bit :

tar -xvf jdk-8u25-linux-i586.tar.gz

 

For 64 Bit :

tar -xvf jdk-8u25-linux-x64.tar.gz

 

3 ) Install and configure Java, Javac, and Jar

We will be using the “alternative” command to install and configure java, javac, and jar

cd /opt/jdk1.8.0_25/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_25/bin/java 2
alternatives --config java

 

( alternatives –config java command will let you choose the desired Java version if you have multiple versions installed in your system. Make sure you choose the version we are installing )

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

 

4) Setup Environment Variables

If you install Java-based applications such as Tomcat, you may have to configure the following environment variables.

export JAVA_HOME=/opt/jdk1.8.0_25
export JRE_HOME=/opt/jdk1.8.0_25/jre
export PATH=$PATH:/opt/jdk1.8.0_25/bin:/opt/jdk1.8.0_25/jre/bin

 

5) Check and Verify

java -version

 

So that’s how you install JAVA 8 on CentOS/Fedora/RHEL.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

Linux Management Services

Focus on your business, and let us take care of your Linux Servers!
From what you are reading, it seems you are interested in Linux and related technologies. If you have a moment to spare, please take a look at our Linux Management Services plan, which might interest you even more!
Linux Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

Introducing - WPHealers!

Complete WordPress Management, 24x7 Support & White Label Agency Plans!

WordPress migration service, security, white-label reseller services and lot more! Grab the introductory deals now!

WPHealers

ServerHealers uses cookies.