Install JDK6.27 in Ubuntu11.10

Source: Internet
Author: User
1. First download: Upload

1. Download:

Http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u27-download-440405.html

Select:

Linux x86-Self Extracting Installer 81.20 MB Jdk-6u27-linux-i586.bin

2. Create a Java directory and decompress the downloaded file to the directory:

$ Sudo cp jdk-6u27-linux-i586.bin/usr/lib/jvmFor those who are new to Alibaba Cloud, copy/Usr/lib/jvm. Check the starting position.

$ Cd/usr/lib/jvm

$Chmod u + xJdk-6u27-linux-i586.bin 

$ Sudo./jdk-6u27-linux-i586.bin
$ Sudo mv jdk1.6.0 _ 27/java-1.6.0_27-sun/
$ Sudo ln-s java-1.6.0_27-sun java-6-sun
$ Sudo rm jdk-6u27-linux-i586.bin.

3. Set the environment variables, including PATH, CLASSPATH, and JAVA_HOME. Note the bin directory added at the end of PATH:

$ Sudo vi/etc/environment
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/lib/jvm/java-6-sun/bin"
CLASSPATH = "/usr/lib/jvm/java-6-sun/lib"
JAVA_HOME = "/usr/lib/jvm/java-6-sun"

4. Then we want to tell the system that we are using sun's JDK, www.linuxidc.com, rather than OpenJDK:

$ Sudo update-alternatives -- install/usr/bin/java/usr/lib/jvm/java-6-sun/bin/java 300

$ Sudo update-alternatives -- install/usr/bin/javacjavac/usr/lib/jvm/java-6-sun/bin/javac 300

$ Sudo update-alternatives -- config java

Two candidate items can be used to replace java (/usr/bin/java ).
Select the path priority status
------------------------------------------------------------
0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 automatic mode
1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
* 2/usr/lib/jvm/java-6-sun/bin/java 300 manual mode

To maintain the current value
  • Press ENTER or enter the selected number: 2

    As shown above, you have set the java to be used. Finally, let's verify:

    $ Java-version
    Java version "1.6.0 _ 27"
    Java (TM) SE Runtime Environment (build 1.6.0 _ 27-b07)
    Java HotSpot (TM) Server VM (build phases 2-b06, mixed mode)

    After finishing your work!
  • 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.