Sunday, March 29, 2015

How to install JDK 8 on CentOS

P
Installing JDK 8 is similar to JDK 7. From command line, run this 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/8u40-b26/jdk-8u40-linux-i586.rpm

And for x64 machine:

[root@localhost phuongvu]# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.rpm

It takes you some minutes to download
--2015-03-29 08:48:29--  http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jd                                                                                        k-8u40-linux-i586.rpm
Resolving download.oracle.com... 23.5.165.197, 23.5.165.154
Connecting to download.oracle.com|23.5.165.197|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-                                                                                        i586.rpm [following]
--2015-03-29 08:48:29--  https://edelivery.oracle.com/otn-pub/java/jdk/8u40-b26/                                                                                        jdk-8u40-linux-i586.rpm
Resolving edelivery.oracle.com... 23.51.134.140
Connecting to edelivery.oracle.com|23.51.134.140|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-i5                                                                                        86.rpm?AuthParam=1427593831_fdd8a8bb7b24369a295a6f3b632a4412 [following]
--2015-03-29 08:48:31--  http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jd                                                                                        k-8u40-linux-i586.rpm?AuthParam=1427593831_fdd8a8bb7b24369a295a6f3b632a4412
Reusing existing connection to download.oracle.com:80.
HTTP request sent, awaiting response... 200 OK
Length: 153976545 (147M) [application/x-redhat-package-manager]
Saving to: “jdk-8u40-linux-i586.rpm”

83% [=====================>                     ] 129,065,363  182K/s  eta 72s

Check your downloaded installer file
[root@localhost phuongvu]# ls
Desktop    Downloads                Music     Public     Videos
Documents  jdk-8u40-linux-i586.rpm  Pictures  Templates
Now, just install it
[root@localhost phuongvu]# rpm -ivh jdk-8u40-linux-i586.rpm
Preparing...                ########################################### [100%]
   1:jdk1.8.0_40            ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...
Check whether JDK 8 has been installed.
[root@localhost phuongvu]# java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) Client VM (build 25.40-b25, mixed mode, sharing)
Now your PC has been installed JDK 8. You can set JAVA_HOME variable by typing
[root@localhost phuongvu]# export JAVA_HOME=/usr/java/latest

No comments:

Post a Comment