Ubuntu 11.04 under Installation configuration JDK 7

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/snowdream86/article/details/6677450

First step: Download jdk-7-linux-i586.tar.gz [Plain]View Plaincopy
    1. Wget-c http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz

(Note: If the download is not down, it is recommended to use Thunderbolt download, and then copied to the Linux system.) )

Step Two: Unzip the installation [Plain]View Plaincopy
    1. sudo tar zxvf./jdk-7-linux-i586.tar.gz-c/USR/LIB/JVM
    2. Cd/usr/lib/jvm
    3. sudo mv Jdk1.7.0/java-7-sun
Step Three: Modify environment variables [Plain]View Plaincopy
    1. Vim ~/.BASHRC
Add to:
[Plain]View Plaincopy
    1. Export Java_home=/usr/lib/jvm/java-7-sun
    2. Export JRE_HOME=${JAVA_HOME}/JRE
    3. Export Classpath=.:${java_home}/lib:${jre_home}/lib
    4. Export Path=${java_home}/bin: $PATH
Save the exit and enter the following command to take effect immediately. [Plain]View Plaincopy
    1. SOURCE ~/.BASHRC
Fourth Step: Configure the default JDK version because there may be default JDK in Ubuntu, such as OPENJDK, we do the following to set up our installed JDK as the default JDK version.
Execute code:
[Plain]View Plaincopy
    1. sudo update-alternatives--install/usr/bin/java Java/usr/lib/jvm/java-7-sun/bin/java 300
    2. sudo update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/java-7-sun/bin/javac 300
    3. sudo update-alternatives--install/usr/bin/jar Jar/usr/lib/jvm/java-7-sun/bin/jar 300
    4. sudo update-alternatives--install/usr/bin/javah javah/usr/lib/jvm/java-7-sun/bin/javah 300
    5. sudo update-alternatives--install/usr/bin/javap JAVAP/USR/LIB/JVM/JAVA-7-SUN/BIN/JAVAP 300

Execute code:
[Plain]View Plaincopy
    1. sudo update-alternatives--config java

The various JDK versions are listed as follows:
[Plain]View Plaincopy
  1. [Email protected]:~$ sudo update-alternatives--config java
  2. There are 3 candidates that can be used to replace Java (providing/usr/bin/java).
  3. Select Path Priority state
  4. ------------------------------------------------------------
  5. * 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Auto mode
  6. 1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Manual Mode
  7. 2/usr/lib/jvm/java-6-sun/jre/bin/java 63 Manual Mode
  8. 3/usr/lib/jvm/java-7-sun/bin/java 300 Manual Mode
  9. To maintain the current value [*] press ENTER, or type the number of your choice: 3
  10. Update-alternatives: Use/usr/lib/jvm/java-7-sun/bin/java to provide/usr/bin/java (Java) in manual mode.
Fifth Step: Test [Plain]View Plaincopy
    1. [Email protected]:~$ java-version
    2. Java Version "1.7.0"
    3. Java (TM) SE Runtime Environment (build 1.7.0-b147)
    4. Java HotSpot (TM) Server VM (build 21.0-b17, Mixed mode)



Reference Links:
1. Install the JDK under Ubuntu 10.10 to configure Eclipse and Tomcat "reprint + correction" http://www.cnblogs.com/evasnowind/archive/2011/01/05/1926059.html
2, Ubuntu installation JDK whole process (for reference only) http://forum.ubuntu.org.cn/viewtopic.php?t=183803
3, Java Learning _JDK installation http://www.cnblogs.com/shaoguobao/archive/2011/07/16/2108015.html

Ubuntu 11.04 under Installation configuration JDK 7

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.