centos--Installing the JDK

Source: Internet
Author: User

First, the problem description

Using CentOS is nothing more than a server, but the CentOS itself comes with OPENJDK, which is different from the JDK implementations of our usual sun (now Oracle), and we need to uninstall it. Otherwise, there will be different run results when calling Java or Javac commands.

Second, how to uninstall and install

1. First find out what the OPENJDK installation version already exists: Rpm-qa | grep JDK

Can see

There are two Java or JDK related software, at this point we need to try the rpm command to uninstall the software

2. Since both software has dependencies, so we try to force uninstall, regardless of the way

RPM-E--nodeps the corresponding name

3. Download the JDK installation package and unzip it into the/usr/local/java directory

Copy the tar.gz file to the/usr/local/java folder

Unziptar-xzvf. tar.gz file

4. Modify the configuration file Vim/ect/profile

Export java_home=/usr/local/javaexport CLASSPATH=.:$JAVA _home/jre/lib/rt.jar:$JAVA _home /lib/dt.jar:$JAVA _home/lib/tools.jarexport PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/ Usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:$JAVA _home/bin

Save exit: Wq

5. Allow profile configuration to take effect

Source/ect/profile

6. Check if Java is installed successfully

Java-version

Iii. problems that may arise

Java-version:

CentOS Java cannot execute binary file

You may have 64-bit installed, and the machine is 32-bit.

centos--Installing the JDK

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.