Saturday, March 28, 2015

How to install JDK 7 on CentOS

P
This article will show you how to download and install JDK 7 on CentOS through command line in case your PC has been installed the no GUI version.
Step 1: Download the file installer from this server to your machine, paste below code for x86 machine
[root@localhost phuongvu]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-i586.rpm
And if your machine is x64
[root@localhost phuongvu]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.rpm
OK. let have a check
[root@localhost phuongvu]# ls
Desktop    Downloads                Music     Public     Videos
Documents  jdk-7u75-linux-i586.rpm  Pictures  Templates

Step 2: Install the file you just have downloaded
[root@localhost phuongvu]# rpm -ivh jdk-7u75-linux-i586.rpm
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
Now, check whether JDK is installed or not
[root@localhost phuongvu]# java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) Client VM (build 24.75-b04, mixed mode, sharing)
Now your PC has been installed JDK 7. You can set JAVA_HOME variable by typing
[root@localhost phuongvu]# export JAVA_HOME=/usr/java/latest
Done.

No comments:

Post a Comment