ubuntu12.04 Installation 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 MKDIR/USR/LIB/JVM
  2. sudo tar zxvf jdk-7u5-linux-x64.tar.gz-c /USR/LIB/JVM
Step Three: Change the environment variables
    1. sudo gedit/etc/profile
Join:
  1. #set java environment
  2. Export Java_home=/usr/lib/jvm/java-7-sun
  3. Export JRE_HOME=${JAVA_HOME}/JRE
  4. Export Classpath=.:${java_home}/lib:${jre_home}/lib
  5. Export Path=${java_home}/bin: $PATH

Save the exit and enter the following command to take effect immediately.


Fourth Step: Configure the default JDK version number to set the JDK we installed as the default JDK version number, for example, the following work.
To run the 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
To run the code:
    1. sudo update-alternatives--config java
The various JDK version numbers are listed, as seen below:
  1. < Span style= "margin:0px; padding:0px; Border:none; Background-color:inherit ">[email protected]:~$ sudo update-alternatives --config java   
  2. There are 3 candidates that can be used to replace Java (providing/usr/bin/java).
  3. -- ----------------------------------------------------------  
  4. *  0            /usr/lib/jvm/java-6-openjdk/jre /bin/java   1061       own active mode   
  5. To maintain the current value [*] press ENTER, or type the number of your choice: 3
  6. Update-alternatives: Use/usr/lib/jvm/java-7-sun/bin/java to provide/usr/bin/java (Java) in manual mode.
Fifth Step: Test
  1. Java-version (will show a demo sample such as the following information, indicating that the configuration was successful)
  2. Java Version "1.7.0"
  3. Java (TM) SE Runtime Environment (build 1.7.0-b147)
  4. Java HotSpot (TM) Client VM (build 21.0-b17, Mixed mode)

ubuntu12.04 Installation 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.