To install Java in Redhat Enterprise Linux follow these steps:

  • we are installing from OpenJDK rpm with command line

Run the following command to install the developer version of OpenJDK

# yum install java-1.7.0-openjdk-devel
  • (Optional) It is sometimes required to set the JAVA_HOME path variable.

You can know the java path by

echo $JAVA_HOME

It will give the path where Java is

In my case it was something like : /usr/lib/jvm/jre-1.8.0-openjdk/bin/java remember it might be different in your case.

Now,

in .bashrc file which is in home directory lets add the java home path as:

I am editing the file in vim editor

[[email protected] ~]$ vi .bashrc

at the bottom of file add the java path in following format:

export JAVA_HOME="/path/to/java/home"

in my case, I added:

#java home path
export JAVA_HOME="/usr/lib/jvm/jre-1.8.0-openjdk/bin/java"

To save first press teCtrl+ O and then

:wq

semicolon and then w and q and press enter.

You are done!

You can check the java version installed with:

java -version

My output was:

java version "1.7.0_141"
OpenJDK Runtime Environment (rhel-2.6.10.1.el7_3-x86_64 u141-b02)
OpenJDK 64-Bit Server VM (build 24.141-b02, mixed mode)

You can get full documentation here






Posts you might like


Viewing the list of Java version installed and selecting the default one

Viewing the list of Java version installed and selecting the default one on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Instaling Netbeans in Redhat Linux

Netbeans on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Installing Open Broadcaster Software OBS in Redhat Enterprise Linux 7

OBS on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Installing VLC media player in Redhat Enterprise Linux 7

Installing VLC media player in RHEL is so easy than you thought on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Installing Jekyll on Redhat Enterprise Linux

Know how to install Jekyll static website generator on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Windows boot option missing after installing redhat in dualboot SOLVED

Windows boot option missing after installing redhat/ centos in dualboot on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Sublime Text Editor in RHEL 7

Easiest way to install Sublime Text Editor on Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more





Mounting NTFS File System Drive in RHEL 7

A simple walk through on mounting NTFS drives in Redhat Enterprise Linux | Redhat Enterpise Linux Blog , How to read more