Manually install JDK under Ubuntu10.04

Source: Internet
Author: User
1. Download the installation file from the official website (http://www.Oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html) (such as: jdk-6u33-linux-x64.bin ). Copy the file to/usr/lib/java. If there is no java folder, create it. By default, the security file has no execution permission. Therefore, the first step is to grant the executable permission to the installation file.

1. Download the installation file from the official website (http://www.Oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html) (such as: jdk-6u33-linux-x64.bin ). Copy the file to/usr/lib/java. If there is no java folder, create it. By default, the security file has no execution permission. Therefore, the first step is to grant the executable permission to the installation file, you can do this by running $ sudo chmod u + x/usr/lib/java/jdk-6u33-linux-x64.bin.

2. After Successfully modifying the permissions of the Installation File, run the command $ cd/usr/lib/java/to enter the java directory and then run the command $. /jdk-6u33-linux-x64.bin, the screen will appear installation tree, and finally need to enter the carriage return, when the press the Enter key prompt installation is complete. The current directory contains an additional jdk 1.6.0 _ 33 Directory, which means that jdk has been installed successfully.

3. After successfully installing JDK, We will configure JDK. Run the $ sudo gedit/etc/environment command to modify the environment file and add the following code:

PATH = "/usr/lib/java/jdk1.6.0 _ 33/bin"
CLASSPATH =.: $ java_home \ lib \ tools. jar: $ java_home \ lib \ dt. jar
JAVA_HOME = "/usr/lib/java/jdk1.6.0 _ 33"

If the PATH already exists, use the colon as the interval and add the bin directory address of jdk. In this way, the java environment variable is configured successfully, so that the jdk we installed is used by default, you also need to execute the following command:

Sudoupdate-alternatives-install/usr/bin/java/usr/lib/java/jdk1.6.0 _ 33/bin/java 300

Sudo update-alternatives-install/usr/bin/javac/usr/lib/java/jdk1.6.0 _ 33/bin/javac 300

Sudo update-alternatives -- config java

4. Run the command successfully. The JDK we installed is the default one. Then, run the java-version command to view the JDK information:

Java version "1.6.0 _ 33"

Java (TM) SE Runtime Environment (build 1.6.0 _ 33-b04)

JavaHotSpot (TM) 64-Bit Server VM (build between 8-b03, mixed mode)

5. Configure classpath and modify the environment variables of all users

$ Sudo gedit/etc/profile

Add at the end of the file

# Set java environment
JAVA_HOME =/usr/lib/java/jdk1.6.0 _ 33
Export JRE_HOME =/usr/java/jdk1.6.0 _ 33/jre
ExportCLASSPATH =.: $ JAVA_HOME/lib: $ JRE_HOME/lib: $ CLASSPATH
Export PATH = $ JAVA_HOME/bin: $ JRE_HOME/bin: $ PATH

 

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.