Install JDK 7 on centos 6.0

Source: Internet
Author: User

1. Download jdk-7-linux-x64.rpm (http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html)

2. Switch Su to root

3./usr/Java/jdk1.7.0
Rpm-IVH jdk-7-linux-x64.rpm, default installation path:/usr/Java/jdk1.7.0

4. VI/etc/profile

5. append at the end of profile:

[Plain]
View plaincopyprint?
  1. Export java_home =/usr/Java/jdk1.7.0
  2. Export classpath =.: $ java_home/JRE/lib/RT. jar: $ java_home/lib/dt. jar: $ java_home/lib/tools. Jar
  3. Export Path = $ path: $ java_home/bin

Export java_home =/usr/Java/jdk1.7.0 <br/> export classpath =.: $ java_home/JRE/lib/RT. jar: $ java_home/lib/DT. jar: $ java_home/lib/tools. jar <br/> export Path = $ path: $ java_home/bin

Note that the link in the middle is a colon, not a semicolon!

Path = $ path: $ java_home/bin is the definition variable

Export Path = $ path: $ java_home/bin must be export to take effect

When using export, remember to include the original path with Path = $ path: $ home/bin. Otherwise, the system path will be overwritten.

6. Source/etc/profile

7. Install update-Alternatives

Update-alternatives -- install/usr/bin/Java/usr/Java/jdk1.7.0/bin/Java 60

Configure JDK

Update-alternatives -- config Java

Then

[Plain]
View plaincopyprint?
  1. There are two programs that provide "Java ".
  2. Select command
  3. -----------------------------------------------
  4. * + 1/usr/lib/JVM/jre-1.6.0-openjdk/bin/Java
  5. 2/usr/Java/jdk1.7.0/bin/Java
  6. Press enter to save the current selection [+], or type the selection number: 2

There are two programs that provide "Java ". </P> <p> SELECT command <br/> --------------------------------------------- <br/> * + 1/usr/lib/JVM/jre-1.6.0-openjdk/bin/Java <br/> 2/usr /Java/jdk1.7.0/bin/Java </P> <p> press enter to save the current selection [+]. or enter the selected number: 2.

Press enter.

Java-version output

[Plain]
View plaincopyprint?
  1. Java version "1.7.0"
  2. Java (TM) se Runtime Environment (build 1.7.0-b147)
  3. Java hotspot (TM) 64-bit server VM (build 21.0-b17, mixed mode)

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.