Linux under Configuration jdk1.7

Source: Internet
Author: User

First step: Download jdk-7-linux-i586.tar.gz
    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
    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
    1. Vim ~/.BASHRC
Add to:
    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.

    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:
    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
Execute code:
    1. sudo update-alternatives--config java
The various JDK versions are listed as follows:
  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
      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)

Linux under Configuration jdk1.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.