CentOS installation JDK

Source: Internet
Author: User

Article excerpt from: http://www.iteye.com/topic/1130311

Install jdk-7u17-linux-x64.rpm (jdk with. rpm suffix)

1. First look at the OPENJDK installation package

$ RPM-QA |grep java
Tzdata-java-2013b-1.el6.noarch
Java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
Java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64

2. Check the OPENJDK version
$ java-version
Java Version "1.7.0_19"
OpenJDK Runtime Environment (RHEL-2.3.9.1.EL6_4-X86_64)
OpenJDK 64-bit Server VM (build 23.7-b01, Mixed mode)

3. Uninstalling OPENJDK
Log in to the terminal with the root user

$ su Root

Password:
$ rpm-e--nodeps java-1.7.0-openjdk-1.7.0.19-2.3.9.1.el6_4.x86_64

$ rpm-e--nodeps java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.x86_64
$ rpm-e--nodeps Tzdata-java-2013b-1.el6.noarch

4 Installing JDK-7U17-LINUX-X64.RPM

: http://pan.baidu.com/share/link?shareid=397488&uk=638583574

$ cd/jdk1.7 in your directory

$ RPM-IVH jdk-7u17-linux-x64.rpm
Preparing ... ########################################### [100%]
1:JDK ########################################### [100%]
Unpacking JAR files ...
Rt.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/rt.pack
Jsse.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/jsse.pack
Charsets.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/charsets.pack
Tools.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/lib/tools.pack
Localedata.jar ...
Error:could not open input file:/usr/java/jdk1.7.0_17/jre/lib/ext/localedata.pack
These errors can be ignored without affecting the JDK to install and use

5. Configure Environment variables

$vi/etc/profile

Enter o and at the end add the following:

Java_home=/usr/java/jdk1.7.0_17
Jre_home=/usr/java/jdk1.7.0_17/jre
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
Export Java_home jre_home PATH CLASSPATH
Make environment variables effective immediately

$source/etc/profile

6. Test whether the installation was successful

Enter Java,java-version,javac in turn to see the output information, such as

[Email protected] tools]# java-version
Java Version "1.7.0_17"
Java (TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot (TM) 64-bit Server VM (build 23.7-b01, Mixed mode)

CentOS installation JDK

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.