Ubuntu11.04 change the default JDK

Source: Internet
Author: User
Ubuntu11.04 comes with the default OpenJDK. Although many articles on the Internet say that OpenJDK is no different from Sun's JDK, use the official JDK just in case. Step 1, install Sun's JDK: sudoapt-getinstallsun-java6-jresudoapt-getinstallsun-java6-jdk at this time, enter java-version in the command line, the JDK is still OpenJ

Ubuntu 11.04 comes with the default OpenJDK. Although many articles on the Internet say that OpenJDK is no different from Sun's JDK, use the official JDK just in case.

Step 1: Install Sun's JDK:

Sudo apt-get install sun-java6-jre

Sudo apt-get install sun-java6-jdk

In this case, enter java-version in the command line, and the displayed JDK is still OpenJDK. Therefore, you need to modify the default JDK.

Step 2: Modify the default JDK

Sudo update-alternatives -- config java

In this case, the command line prompts you to select the appropriate JDK, as shown in figure

There are 2 choices for the alternative java (providing/usr/bin/java ).


Selection Path Priority Status
------------------------------------------------------------
* 0/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1/usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2/usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode


Press enter to keep the current choice [*], or type selection number: 2

After selecting java-6-sun and entering java-version, Sun's JDK information will be displayed.

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.