Configuring Oracle Java

  • Check the current java version:-

java -version

We can see that there is no OpenJdk installed

  • Install OpenJDK 8 JDK

To install OpenJDK 8 JDK using yum, run this command:

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

At the confirmation prompt, enter y then RETURN to continue with the installation.

  • Now re-check the java version.

java -version
  • Set JAVA_HOME variable and append to the PATH Note: Please specify the path of JAVA_HOME as per your version.

echo $JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64
export PATH=$PATH:$JAVA_HOME
echo $JAVA_HOME
echo $PATH

Last updated