Install Java 11.10 on Ubuntu)

Source: Internet
Author: User
Install the Java environment on Ubuntu 11.10

Statement: The content here is mainly from the network. Based on this, I made some simple (but valuable) Remarks and modifications based on my own success experience.

(I am also Ubuntu 11.10, but it is 64-bit, so the installed Java is also 64-bit .)

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.
The addresses of Java JDK and JRE are: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u29-download-513648.html

Http://www.oracle.com/technetwork/java/javase/downloads/jre-6u29-download-513650.html

Select the link for Linux x64 or Linux x86. Do not select rpm. bin. Select. Bin. I don't know why.

(I am using the root user, but I don't know if my individual user can do it. If you need to use the root user, first set the root password with $ sudo passwd root and use $ su root to log on)
First, create a Java directory and decompress the downloaded file to the directory:

$ CD/usr/lib
$ Mkdir JVM
$ Sudo CP jdk-6u27-linux-i586.bin/usr/lib/JVM
$ CD/usr/lib/JVM

$ Sudo chmode + x jdk-6u27-linux-i586.bin (do not miss this step, modify file access permissions)
$ Sudo./jdk-6u27-linux-i586.bin

(I didn't execute Step 3. I didn't understand it. It succeeded anyway)
$ 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:
(I used $ sudo gedit/etc/environment. It should be different from the text editing tool)
$ 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"
Java_home = "/usr/lib/JVM/Java-6-Sun"

Classpath = "/usr/lib/JVM/Java-6-sun/lib"

(It can also be classpath = "$ java_home/lib" Here Java-6-sun isJDKDirectory insteadJREDirectory)
The next step is to tell the system that we are using sun's JDK, instead of openjdk: (this step is very important. I just failed to execute the following code, leading to the failure to recognize Java commands)
(Note that the two lines in the West -- install the following four parameters are the Link name and path priority. We only need to modify the corresponding path, but I have not moved the other parameters)
$ 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 !)

//// I did not execute the following because I did not understand it !! Xi ~

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)

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.