CentOS-6.3 installation configuration JDK-7

Source: Internet
Author: User
Zhoulf 2013-02-04 original http://www.cnblogs.com/zhoulf/archive/2013/02/04/2891608.htmlinstallation instructions

System Environment: centos-6.3

Installation Method: rpm Installation

Software: jdk-7-linux-x64.rpm

: Http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

Check the original system version

[Root @ admin ~] # Java-version

Java version "1.6.0 _ 24"

Openjdk Runtime Environment (icedtea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)

Openjdk 64-bit server VM (build between 0-b12, mixed mode)

To further view the JDK information:

[Root @ admin ~] # Rpm-Qa | grep Java

Tzdata-java-2012c-1.el6.noarch

Java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64

Uninstall openjdk and perform the following operations:

[Root @ admin ~] # Rpm-e -- nodeps tzdata-java-2012c-1.el6.noarch

[Root @ admin ~] # Rpm-e -- nodeps java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64
Install JDK

Upload new jdk-7-linux-x64.rpm software to/usr/local/to perform the following operations:

[Root @ admin local] # rpm-IVH jdk-7-linux-x64.rpm

JDK is installed in/usr/Java by default.

Verify Installation

Perform the following operations to check whether the information is normal:

[Root @ admin bin] # Java

[Root @ admin bin] # javac

[Root @ admin bin] # Java-version

Java version "1.7.0"

Java (TM) se Runtime Environment (build 1.7.0-b147)

Java hotspot (TM) 64-bit server VM (build 21.0-b17, mixed mode)

Congratulations! The installation is successful!

Configure Environment Variables

After installing the jdk-7-linux-x64.rpm on my machine, I can still perform the javac and Java-version operations without configuring environment variables, so I didn't configure JDK environment variables. However, for future discomfort, we should record how to configure it as follows:

Modify the system environment variable File

Vi +/etc/profile

Append the following content to the file:

Java_home =/usr/Java/jdk1.7.0

Jre_home =/usr/Java/jdk1.7.0/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 the modification take effect

[Root @ admin local] # source/etc/profile // make the modification take effect immediately

[Root @ admin local] # echo $ PATH // view the PATH value

View system environment status

[Root @ admin ~] # Echo $ path

/Usr/local/cmake/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin: /usr/sbin:/usr/bin:/usr/Java/jdk1.7.0/bin:/usr/Java/jdk1.7.0/JRE/bin:/root/bin

 

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.