We would to install Oracle JDK instead of openjdk on this Oracle Linux virtual machine :

[root@oracle ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

Download the RPM from Oracle :

  • Go to “/tmp” directory :
[root@oracle ~]# cd /tmp
  • Install “wget” :
[root@oracle tmp]# yum -y install wget
  • And retrieve the archive :
[root@oracle tmp]# 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/8u102-b14/jdk-8u102-linux-x64.tar.gz"

Install this RPM :

  • Go to “/opt” directory :
[root@oracle tmp]# cd /opt
  • And extract this archive :
[root@oracle opt]# tar xzf /tmp/jdk-8u102-linux-x64.tar.gz

Select Oracle JDK :

If openJDK has already been installed,

  • Create required symbolic links :
[root@oracle opt]# alternatives --install /usr/bin/java java /opt/jdk1.8.0_102/bin/java 2
  • And select Oracle JDK as the primary JDK :
[root@oracle opt]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
*+ 1           /usr/lib/jvm/java-1.8.0-openjdk-
   2           /opt/jdk1.8.0_102/bin/java

Enter to keep the current selection[+], or type selection number: 2

Your Oracle Java JDK8 installation is now finished :

[root@oracle opt]# java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Don’t forget to set your environmental variables :

[root@oracle opt]# awk -v RS= '/^# Oracle/ {if (first) print "";print;first=1}' ~wou/.bash_profile
# Oracle Java JDK8 :


www.pdf24.org    Send article as PDF   

Leave a Reply

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