Install Java JDK 8 in Red Hat Linux

Download Link for JDK

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Filename: jdk-8u111-linux-x64.rpm

 

Check Java in your machine

# java -version

#echo $JAVA_HOME

Remove java from your machine

# Yum remove java*

 

Installing Java

# rpm -Uvh jdk-8u111-linux-x64.rpm

# vi /etc/profile

In Editor write following

export JAVA_HOME=/usr/java/default

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

# source /etc/profile

Then check the java installation by follwoing command

# java -version

#echo $JAVA_HOME