Please follow the steps to install Oracle JDK in CentOS:
1) Identify the download URL of Oracle JDK.

  • Login to Oracle JDK download page:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

  • Click on the Download JDK button in the Oracle JDK download page

  • Click and select the “Accept License Agreement” radio button.
  • Mouse over the hyperlink and note down the url:

  • For example, the hyperlink will be something like this:




http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.rpm
2) Login to the CentOS using SSH
Execute this command to download the rpm file. Change the url to the result from step 1.
wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.rpm
3) Install Oracle JDK
Execute this command to install Oracle JDK. Change the file name to the rpm file name which is downloaded from step 2.
sudo yum localinstall jdk-8u111-linux-x64.rpm
4) Verify Oracle JDK
Execute this command to verify the Oracle JDK
java -version
The result:
java version “1.8.0_111”
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

Leave a Reply

Your email address will not be published. Required fields are marked *