Topic: centos6.4 install JDK

Source: Internet
Author: User

1. Check the openjdk installation package first.

$ 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. Uninstall openjdk
Log on to the terminal as a 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 install jdk-7u17-linux-x64.rpm

: Http://pan.baidu.com/share/link? Consumer id = 397488 & UK = 638583574

$ CD/jdk1.7 directory

$ Rpm-IVH jdk-7u17-linux-x64.rpm
Preparing... ######################################## ### [100%]
1: JDK ####################################### #### [100%]
Unpacking jar files...
Rt. jar...
Error: cocould not open input file:/usr/Java/jdk1.7.0 _ 17/JRE/lib/RT. Pack
JSSE. jar...
Error: cocould not open input file:/usr/Java/jdk1.7.0 _ 17/JRE/lib/JSSE. Pack
Charsets. jar...
Error: cocould not open input file:/usr/Java/jdk1.7.0 _ 17/JRE/lib/charsets. Pack
Tools. jar...
Error: cocould not open input file:/usr/Java/jdk1.7.0 _ 17/lib/tools. Pack
Localedata. jar...
Error: cocould not open input file:/usr/Java/jdk1.7.0 _ 17/JRE/lib/EXT/localedata. Pack
The preceding errors can be ignored without affecting JDK installation and use.

5. Configure Environment Variables

$ VI/etc/profile

Input O and add the following content at the end:

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 take effect immediately

$ Source/etc/profile

6. test whether the installation is successful.

Enter Java, Java-version, and javac in sequence to view the output information, for example

[Root @ chenpc-cent 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) topic: centos6.4 install JDK

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.