Linux under Configuration jdk1.7

Source: Internet
Author: User

First step: Download jdk-7-linux-i586.tar.gz
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
sudo tar zxvf./jdk-7-linux-i586. tar. GZ  -c/usr/lib/JVM  /usr/lib/jvm  sudomv jdk1.  7.0/java-7-sun  

Step Three: Modify environment variables
Vim ~/.BASHRC  

Add to:

Export java_home=/usr/lib/jvm/java-7-Sun  export jre_home=${java_home}/JRE  Export CLASSPATH=.:${java_home}/lib:${jre_home}/lib  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 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:
sudo update-alternatives--install /usr/bin/java java/usr/lib/jvm/java-7  sudo update-alternatives--install /usr/bin/javac javac/usr/lib/jvm/java-7300   

Execute code:

sudo update-alternatives--config java  

The various JDK versions are listed as follows:

[Email protected]:~$sudoUpdate-alternatives--config Java has3Candidate can be used to replace Java (provides a/usr/bin/Java). Select Path Priority State------------------------------------------------------------  *0/usr/lib/jvm/java-6-openjdk/jre/bin/java1061Automatic mode1/usr/lib/jvm/java-6-openjdk/jre/bin/java1061Manual Mode2/usr/lib/jvm/java-6-sun/jre/bin/java theManual Mode3/usr/lib/jvm/java-7-sun/bin/java -Manual mode to maintain the current value [*] Press ENTER, or type the number you selected:3Update-alternatives: Using/usr/lib/jvm/java-7-sun/bin/java to provide/usr/bin/java (Java) in manual mode.
Fifth Step: Test
[Email protected]:~$ java-version  "1.7.0"  1.7.  0-b147)  21.0

Thank you: http://blog.csdn.net/hzqnju/article/details/6779556

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.