Tuesday, 23 February 2016

How to install Java 7/jdk1.7 in Centos7/RHEL7



Step 1: Download java from oracle official site:

Download “jdk-7u79-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-7u79-linux-x64.rpm
[root@linuxcnf opt]# rpm -ivh jdk-7u79-linux-x64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk-2000:1.7.0_79-fcs            ################################# [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...

Step 3: Set Environment Variables:

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

Step 4: Verify Installation

[root@linuxcnf ~]# java –version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
[root@linuxcnf ~]# echo $JAVA_HOME
/usr/java/jdk1.7.0_79
[root@linuxcnf ~]# echo $PATH
/usr/java/jdk1.7.0_79bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:
JAVA_HOME/bin:/usr/java/ jdk1.7.0_79/bin:/usr/java/ jdk1.7.0_79/bin:/usr/java/ jdk1.7.0_79/bin

Java 7 installation is done!!!

No comments:

Post a Comment