Installing the JDK in a Linux environment

Source: Internet
Author: User

First, installation

Create the installation directory, set up the installation path under/usr/java, and test the file under this path:

mkdir /usr/java

1,Jdk-6u11-linux-i586.bin This is self-extracting files, installed on Linux as follows:

# Cd/usr/java

chmod 755 jdk-6u11-linux-i586.bin #. /jdk-6u11-linux-i586.bin (Note that this step must be in the directory where Jdk-6u11-linux-i586.bin is located)

After you follow the prompts to enter Yes, the JDK is decompressed.

A line of words appears: Do you aggree to the above license terms? [Yes or No]

The installer is asking if you would like to comply with the license agreement you have just seen. Of course agree, enter "Y" or "yes" to return.

2, if use jdk-6u11-linux-i586-rpm.bin This is also a self-extracting file, but the extracted file is jdk-6u11-linux-i586-rpm package, the implementation of RPM command installed on Linux on it. Install the following:

chmod 755 ./jdk-6u11-linux-i586-rpm  #. /jdk-6u11-linux-i586--IVH jdk-6u11-linux-i586-rpm

A line of words appears:

Aggree to the above license terms? [Yes or No]

The installer is asking if you would like to comply with the license agreement you have just seen. Of course agree, enter "Y" or "yes" to return.

Installing the software automatically installs the JDK into the/usr/java/directory.

Second, the configuration
#VI /etc/profile

Add the following content to the inside

Export JAVA_HOME=/USR/JAVA/JDK1. 6 . 0_27export java_bin=/usr/java/jdk1. 6. 0_27/binexport PATH= $PATH: $JAVA _home/binexport CLASSPATH=.: $JAVA _home/lib/dt.jar:$ java_home/lib/tools.jarexport java_home java_bin PATH CLASSPATH

To make the/etc/profile file effective immediately after modification, you can use the following command:

# . /etc/profile

Attention:. and/etc/profile have spaces.

To detect if the installation was successful:

# java-version
" jdk1.6.0_02 " 2 Runtime environment, Standard Edition (build Jdk1. 6. 0_02) Java HotSpot (TM) Client VM (build Jdk1. 6. 0_02, Mixed mode)
Third, uninstall OPENJDK, set the default JDK version

If you perform java-version, the JDK version you installed is not displayed, and you need to set the default JDK version.

1, query the existing installation version
grep JDK
Java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
Java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
Jdk-1.7.0_67-fcs.x86_6

2, uninstall OPENJDK

sudo Yum -y remove java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
4. Set the default JDK (replace the underscore location according to the main directory where Java is located)
Alternatives--install /usr/bin/java java/usr/java/jdk1. 6 1  --install /usr/bin/javac javac/usr/java/jdk1. 6 1
# . /etc/profile

Installing the JDK in a Linux environment

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.