Java is successfully installed in Ubuntu11.10.

Source: Internet
Author: User
Upgrade to Ubuntu11.10, because the library does not have a sun-java6-jdk, you need to install. Therefore, I downloaded Java6u27 from the Oracle website (why not java7? Because there are not many software currently supported, and you can easily switch to Java7 if you really need it), then you can start to manually install it. First create a Java directory, and then extract the downloaded file to the directory: $ sudocpjdk-6u27-linux-i586.bi

After upgrading to Ubuntu 11.10, because there is no sun-java6-jdk in the library, you need to install it on your own. Therefore, I downloaded Java 6u27 from the Oracle website (why not Java 7? Because there are not many software currently supported, and you can easily switch to Java7 if you really need it), then you can start to manually install it.

First, create a Java directory and decompress the downloaded file to the directory:

$ Sudo cp jdk-6u27-linux-i586.bin/usr/lib/jvm

$ Cd/usr/lib/jvm

$ Sudo./jdk-6u27-linux-i586.bin -- mark it here, I am not running successfully online. I changed to $ sudo sh jdk-6u27-linux-i586.bin, don't go deep, can be successful.

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

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:/u

Sr/lib/jvm/java-6-sun/bin"

CLASSPATH = "/usr/lib/jvm/java-6-sun/lib"

JAVA_HOME = "/usr/lib/jvm/java-6-sun"

Then we want to tell the system that we use sun's JDK at www.linuxidc.com, instead of OpenJDK:

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

$ Sudo update-alternatives -- install/usr/bin/javac/usr/lib/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!

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