Sunday 21 February 2016

How to install Java8/jdk1.8 in Centos7/RHEL7



Step 1: Download java rpm package from oracle official site:

Download “jdk-8u60-linux-x64.rpm” from here and save the package to /opt directory or change the directory where you downloaded the package:

Step 2: Install java by enter below command:

[root@linuxcnf ~]# cd /opt/
[root@linuxcnf opt]# ls
jdk-8u60-linux-x64.rpm
[root@linuxcnf opt]# rpm -ivh jdk-8u60-linux-x64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_60-2000:1.8.0_60-fcs    ################################# [100%]
Unpacking JAR files...
        tools.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
        rt.jar...
        jsse.jar...
        charsets.jar...
        localedata.jar...
        jfxrt.jar...

Step 3: Set Environment Variables:

[root@linuxcnf ~]# vi /etc/profile
# add following lines into the end
export JAVA_HOME=/usr/java/jdk1.8.0_60
export PATH=/usr/java/jdk1.8.0_60/bin:$PATH
:wq
[root@linuxcnf ~]#source /etc/profile

Step 4: Verify Installation:

[root@linuxcnf ~]# java –version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
[root@linuxcnf ~]# echo $JAVA_HOME
/usr/java/jdk1.8.0_60
[root@linuxcnf ~]# echo $PATH
/usr/java/jdk1.8.0_60/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:
JAVA_HOME/bin:/usr/java/jdk1.8.0_60/bin:/usr/java/jdk1.8.0_60/bin:/usr/java/jdk1.
8.0_60/bin
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
[root@linuxcnf ~]#

Java 8 installation is done!!!

No comments:

Post a Comment