Install and configure JDK 7 in Ubuntu11.04

Source: Internet
Author: User
Step 1: Download jdk-7-linux-i586.tar.gz wget-chttp: // rewrite (Note: if the download fails, we recommend that you use thunder to download it and copy it to the Linux system .) Step 2: unzip and install sudota Step 1: Download jdk-7-linux-i586.tar.gz
  1. Http://download.Oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz wget-c
(Note: If the download fails, we recommend that you use thunder to download it and copy it to the Linux system .)
Step 2: unzip and install
  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 3: Modify Environment Variables
  1. Vim ~ /. Bashrc
Add:
 
  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 and exit. Enter the following command to make it take effect immediately.

  1. Source ~ /. Bashrc
Step 4: configure the default JDK version. Because Ubuntu may have a default JDK, such as openjdk, the following work is required to set the installed JDK to the default JDK version.
Run the Code:
  1. Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/java-7-sun/bin/java 300
  2. Sudo update-alternatives -- install/usr/bin/javac/usr/lib/jvm/java-7-sun/bin/javac 300
Run the Code:
  1. Sudo update-alternatives -- config java
JDK versions are listed as follows:
  1. Www.linuxidc.com @ linux :~ $ Sudo update-alternatives -- config java
  2. Three candidate items can be used to replace java (/usr/bin/java ).
  3. Select the path priority status
  4. ------------------------------------------------------------
  5. * 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 automatic 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 the Enter key or enter the selected number: 3
  10. Update-alternatives:/usr/lib/jvm/java-7-sun/bin/java is used to provide/usr/bin/java (java) in manual mode.
Step 5: Test
  1. Www.linuxidc.com @ linux :~ $ 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)
Install JDK in Ubuntu 10.10 to configure Eclipse and Tomcat http://www.linuxidc.com/linux/2011-01/31367.htmjava_jdkinstall http://www.linuxidc.com/Linux/2011-08/40685.htm
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.