How To Install Java On RHEL 8: RedHat Tutorial

Insight: How To Install Java On RHEL 8

In this simple tutorial, we are going to show you the method to install Java on RHEL 8.

How To Install Java On RHEL 8 : RedHat Tutorial

You can either install OpenJDK or Oracle Java. It’s up to your requirement.

Install OpenJDK JDK:

yum -y install java-1.8.0-openjdk-devel
yum -y install java-11-openjdk-devel

Install OpenJDK JRE:

yum -y install java-1.8.0-openjdk
yum -y install java-11-openjdk

Install Oracle Java:

Run the following command if you want  to install it via command line procedure:

yum install -y wget
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"


Install Oracle Java JDK using rpm command:

rpm -ivh jdk-12.0.1_linux-x64_bin.rpm
rpm -ivh jdk-11.0.3_linux-x64_bin.rpm
rpm -ivh jdk-8u211-linux-x64.rpm

Run the following command to set default java version in RHEL 8:

alternatives --config java


Setup Environmental Variables In RHEL 8

At first, create a new file under /etc/profile.d directory:

vi /etc/profile.d/


Set variables on the basis of java version:

export PATH=$PATH:/usr/lib/jvm/java-11-openjdk-
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-
export J2SDKDIR=/usr/lib/jvm/java-11-openjdk-

Now you need to load the environments into the current sessions:

source /etc/profile.d/
READ More Relevant Stuff:  Xfce 4.18 Officially Released

Leave a Reply

Your email address will not be published. Required fields are marked *