JDK installation (centos/rpm mode)

Source: Internet
Author: User

1. Use the following command to verify that you have brought your own openjdk

Java-version

If printed as follows, OPENJDK is installed

" 1.6.0 "  1.6. 0-1.6. 0-b09, mixed mode)

2. If the OPENJDK is installed in the first step, you must first uninstall the OPENJDK

rpm–qa| grep Java

Appears as follows (more items may be listed):

java-1.4. 2-gcj-compat-1.4. 2.0-40jpp.  the Java-1.6. 0-openjdk-1.6. 0.0-1.7. B09.el5

To execute the Unload command (which shows several results, execute a few delete commands and delete all the listed results):

Rpm–e–-nodeps java-1.4. 2-gcj-compat-1.4. 2.0-40jpp.  the rpm–e–-nodeps java-1.6. 0-openjdk-1.6. 0.0-1.7. B09.el5

3. Upload the file "jdk-7u75-linux-x64.rpm" to the deployment machine, the location/usr/java/jdk-7u75-linux-x64.rpm, if no this path, the new. Add executable permissions for "jdk-7u75-linux-x64.rpm", with the following command:

chmod 755 jdk-7u75-linux-x64.rpm

4. Install the RPM package

5. Configure Java Environment variables

Use the VI command to modify the/etc/profile file with the following command:

VI /etc/profile

Add the following content:

Export JAVA_HOME=/USR/JAVA/JDK1. 7. 0_75/export Java_bin=/usr/java/jdk1. 7. 0_75/bin/export PATH= $PATH: $JAVA _home/binexport CLASSPATH=.: $JAVA _home/lib/dt.jar:$ java_home/lib/tools.jarexport java_home java_bin PATH CLASSPATH

After the file is modified, save.

6. To bring it into force, an order must be executed:

Source/etc/profile

7. Verify that the Java Runtime Environment is installed successfully, enter the following command:

Java–version

Returning the result, for example, indicates that the installation was successful:

JDK installation (centos/rpm mode)

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.