yum update
search for if any older JDK versions are installed in your system.
rpm -qa | grep -E '^open[jre|jdk]|j[re|dk]'
Sample output:
gobject-introspection-1.36.0-4.el7.x86_64pygobject3-base-3.8.2-4.el7.x86_64
To check the already installed Java version, enter the following command:
java -version
If Java 1.6 or 1.7 have been installed already, you can uninstall them using the following commands.
yum remove java-1.6.0-openjdkyum remove java-1.7.0-openjdk
Download And Install Oracle Java JDK
As I use 64bit CentOS 7 server, I have downloaded the 64bit rpm package.
Then, go to the directory where you’ve downloaded the jdk package, and run the following command to install it.
rpm -ivh jdk-8u25-linux-x64.rpm
Check Java version
java -version
Sample output:
java version "1.8.0_25"Java(TM) SE Runtime Environment (build 1.8.0_25-b17)Java
HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
set configuration
export JAVA_HOME=/usr/java/jdk1.8.0_25/
export PATH=$PATH:$JAVA_HOME
at the end
source /efc/profile