The latest method for jdk66u38 configuration under Ubuntu12.04

Source: Internet
Author: User
/*************************************** ******************************* Author: samson * Date: 01/30/2014 * Testplatform: * & nbsp

/*************************************** ******************************
* Author: Samson
* Date: 01/30/2014
* Test platform:
* Linux Ubuntu 3.2.0-58-generic-pae
* GNU bash, version 4.2.39
**************************************** ****************************/

Openjdk is installed by default in Ubuntu 12.04, but there are many problems with this jdk. Because you cannot even start Eclipse, you still need to install jdk by yourself.

1. Download jdk6
JDK 6 is: http://download.java.net/jdk6/, choose the appropriate installation package for the operating system, I am Ubuntu 12.04 32bit, so the download file is a jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin,

2. Create a folder under/usr/local:
Sudo mkdir java
Cd/usr/local/java
Copy the downloaded jdk6 jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin file to the/usr/local/java directory;

3. Modify jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin file permissions so that it can run:
Sudo chmod u + x jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin

4. Install JDK 6
/Jdk-6u23-ea-bin-b03-linux-i586-18_oct_2010.bin
After the executable program is executed, it is actually to extract the JDK 6 package to the current directory;

5. Modify Environment Variables
Sudo vim/etc/environment

Set the variables:
PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/java/jdk1.6.0 _ 38/bin"
CLASSPATH =.:/usr/local/java/jdk1.6.0 _ 38/lib
JAVA_HOME =/usr/local/java/jdk1.6.0 _ 38
Save and exit.

Configure profile:
Sudo vim/etc/profile
Add the following content at the end of the file:
Export JAVA_HOME =/usr/local/java/jdk1.6.0 _ 38
Export JRE_HOME =/usr/local/java/jdk1.6.0 _ 38/jre
Export PATH = $ PATH:/usr/local/java/jdk1.6.0 _ 38/bin
Export CLASSPATH =./:/usr/local/java/jdk1.6.0 _ 38/lib:/usr/local/java/jdk1.6.0 _ 38/jre/lib

After the configuration is complete, apply:

Sudo source/etc/profile


6. Set the default jdk
Because ubnuntu is installed with openjdk by default, you need to set the default value to JDK 6.

Sudo update-alternatives -- install/usr/bin/java/usr/local/java/jdk1.6.0 _ 38/bin/java 300
Sudo update-alternatives -- install/usr/bin/javac/usr/local/java/jdk1.6.0 _ 38/bin/javac 300

Select the java version for Configuration:
Sudo update-alternatives -- config java
Select the javac version for Configuration:
Sudo update-alternatives -- config javac

When you execute the above two configuration selection commands, the system will prompt you to select the jdk version and select jdk 6.

7. test whether the configuration is correct:
Www.linuxidc.com @ ubuntu:/usr/local/java/jdk1.6.0 _ 38 $ java-version
Java version "1.6.0 _ 38-ea"
Java (TM) SE Runtime Environment (build 1.6.0 _ 38-ea-b04)
Java HotSpot (TM) Server VM (build ipv13-b02, mixed mode)

Www.linuxidc.com @ ubuntu:/usr/local/java/jdk1.6.0 _ 38 $ javac-version
Javac 1.6.0 _ 38-ea

If the jdk version is not set in Step 7, restart the system once.

Reading:

Install JDK 7 (with Clojure download) http://www.linuxidc.com/Linux/2012-10/71557.htm under Ubuntu

Install JDK1.7 http://www.linuxidc.com/Linux/2012-06/62239.htm in Ubuntu 12.04

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.