CentOS installation Java JDK

Source: Internet
Author: User

Under normal circumstances, we will have to uninstall the OpenJDK Linux comes with. Then install Sun's JDK.

First check to see if the Linux-brought JDK is installed.

Enter for example the following command to view the Java version number information that has been installed.

Linux Code
    1. Java-version

Enter for example the following command. View the information for the JDK.

Linux Code
    1. Rpm-qa|grep Java

For example, as seen in the.


Uninstall the Java that you have installed, for example, as seen in.


Uninstall complete. For example, as seen in the.


Uninstall the other one, for example, as seen.


The uninstallation is complete, for example, as seen.



The second step is to install the sun's JDK.

Official website: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Create a Java folder under/usr. In case the Java program is installed in this folder. Enter for example the following command:

Linux Code
    1. Mkdir/usr/java

Copy the downloaded installation file to the original system's shared directory share, and view the file by command:

Linux Code
    1. Cd/mnt/share
    2. Ls-a

Copy the files to the/usr/java folder. Enter for example the following command:

Linux Code
    1. CP *.gz/usr/java

View the/usr/java folder. Enter for example the following command:

Linux Code
    1. Cd/usr/java
    2. Ls-a

For example, as seen in the.


Unzip the file, enter for example the following command:

Linux Code
    1. TAR-XZVF jdk-7u13-linux-x64.gz

After decompression, in the/usr/java folder will be generated a new folder Jdk1.7.0_13, the folder is stored in the extracted files.

For ease of Setup later, we renamed the folder Jdk1.7.0_13 to JDK. Enter for example the following command:

Linux Code
    1. MV Jdk1. 7. 0_13 JDK

For example, as seen in the.


Or, suppose the file you downloaded is in RPM format. Use the tar command above. Replace with the following command to install. The other steps do not change.

Linux Code
    1. RPM-IVH jdk-7u13-linux-x64.rpm

Finally, the environment variable is set.

Enter a configuration file such as the following command.

Linux Code
    1. Vi/etc/profile

For example, as seen in the.



Enter the configuration file. For example, as seen in the. Remove the first row in the red box and change to the following three lines of configuration information.


Let the environment variable take effect.

Run the configuration file so that it takes effect immediately and enter such as the following command:

Linux Code
    1. Source/etc/profile

Verify that the installation is successful, such as the following command:

Linux Code
    1. Java-version

For example, as seen in the. Indicates a successful installation!


Note: Assuming that the Execute java-version command appears:cannot execute binary file, the system version number and JDK version number are not met.

in Linux terminal input; Uname-a


Download the appropriate JDK for the system on Sun's website.


CentOS installation Java JDK

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.