CentOS6.0 uninstall the built-in OpenJDK to upgrade the Java environment

Source: Internet
Author: User
Because CentOS6.0 will install software such as OpenOffice by default, which requires Java support, the system will install a JDK environment by default. if you need to use a specific Java environment, it is best to uninstall or permanently delete the default installed JDK. After CentOS6.0 is installed, enter "java-version" directly in the terminal, the system will display the current jdk version number "java-1.6.0_024", you can see that jdk uses openjd

Because CentOS 6.0 will install software such as OpenOffice by default, which requires Java support, the system will install a JDK environment by default. if you need to use a specific Java environment, it is best to uninstall or permanently delete the default installed JDK.

After CentOS 6.0 is installed, enter "java-version" directly in the terminal, the system will display the current jdk version number "java-1.6.0_024", you can see that jdk uses openjdk1.6.

If you delete java, openoffice, and other related software directly in "application -- add/delete software -- basic system -- java" of centOS, it will be automatically deleted, therefore, it is best to install and configure the New jdk and the corresponding environment before deleting the original JDK.

First, download the corresponding JDK Version from the Sun (now Oracle) website. The latest JDK 1.7 version is used here.

Decompress jdk-7u2-ea-bin-b07-linux-i586-14_sep_2011.tar.gz

Next, set the Java environment variable.
Open/etc/profile in a text editor (note: The/etc/directory under the root directory, where the profile file)
Add the following string to the end of the profile file:
JAVA_HOME =/usr/java/jdk1.7.0 _ 02
PATH = $ JAVA_HOME/bin: $ PATH
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export JAVA_HOME
Export PATH
Export CLASSPATH

Now, the installation and configuration of the New JDK environment are complete.

Next, delete the original jdk environment.

First, enter "rpm-qa | grep gcj" in the terminal to view the gcj version number. The result is as follows:

Java-XXXX.XXXX .....
Libgcj-X.X.X-XXX

Next, uninstall the built-in jdk. Enter "yum-y remove java java-XXXX.XXXX..." in the terminal and wait until the built-in jdk is uninstalled. "Complete!" is displayed in the terminal !", Uninstalled successfully.

So far, JDK configuration for CentOS is basically complete, and the system is restarted.

Enter "java-version" in the terminal, and the system displays:

Java version "1.7.0 _ 02-ea"
Java (TM) SE Runtime Environment (build 1.7.0 _ 02-ea-b07)
Java HotSpot (TM) Client VM (build 22.0-b04, mixed mode)

JDK installed successfully!

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.