Change OpenJDK to SunJDK in Ubuntu

Source: Internet
Author: User
Because openjdk is not available for Hadoop development, it must be replaced with sun's jdk. Therefore, install sunjdk first: Add repositoryadd-apt-repository "debhttp: // "Pay attention to the version and install sun-jdkapt-getupdateapt-getinstallsun-

Because openjdk is not available for Hadoop development, you must replace it with sun's jdk. Therefore, install sunjdk first:

First, add repository.

Add-apt-repository "deb"

Note version

Then install sun-jdk

Apt-get update

Apt-get install sun-java6-jdk sun-java6-plugin

After installation, manually change to sunjdk:

Method 1:

Update-java-alternatives-s java-6-sun

(Or sudo update-alternatives -- config java, select it by yourself)

Because I was not optimistic about the installation process, the computer automatically restarted. As a result, the Ubuntu on the virtual machine was shut down abnormally, and the installation process may be faulty. As a result, when I use this method for conversion after the restart, display Error:

Update-alternatives: Error: No-javaplugin. so candidate item.

So I chose the second method: @ linux:/etc/java-6-sun $ sudo update-alternatives -- config java
Three candidate items can be used to replace java (/usr/bin/java ).

Select the path priority status
/Usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 automatic mode
/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
/Usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1051 manual mode

To maintain the current value [*], press the Enter key or enter the selected number: 2 @ linux:/etc/java-6-sun $ java-version
Java version "1.6.0 _ 26"
Java (TM) SE Runtime Environment (build 1.6.0 _ 26-b03)
Java HotSpot (TM) Client VM (build between 1-b02, mixed mode, sharing)

Related Article

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: 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.