Just follow the steps below.
# yum update -y # yum install java-1.8.0-openjdk -y
Set Class Path as below.
# echo "JAVA_HOME=/usr/bin" >> /root/.bash_profile # echo "export JAVA_HOME" >> /root/.bash_profile # JAVA_HOME=/usr/bin # export JAVA_HOME
Done !