Uninstall the built-in java

Source: Internet
Author: User
In general, we need to uninstall the OPENJDK that comes with linux, and then install the sun jdk. First, check whether the JDK that comes with Linux is installed & lt; 1 & gt; # java-version & n

In general, we need to uninstall the OPENJDK that comes with linux, and then install the sun jdk.

First, check whether the built-in JDK of Linux is installed.
<1> # java-version // view installed JAVA version information
The following information is generally obtained:
Java version "1.6.0"
OpenJDK Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

<2> # rpm-qa | grep java // view jdk information
The following information is generally obtained:
Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
<3> # yum-y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 // uninstall
Yum-y remove java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

Step 2: install SUN's JDK
<1> Download JDK for jdk-6u23-linux-x64-rpm.bin or jdk-6u23-linux-x64.bin from SUN
Create a java folder under/usr and put the installation package in the/usr/java directory.
# Mkdir/usr/java

<2> install JDK
# Cd/usr/java
① Install jdk-6u23-linux-x64-rpm.bin files
# Chmod 777 jdk-6u23-linux-x64-rpm.bin // modified to executable
#./Jdk-6u23-linux-x64-rpm.bin // select yes to agree to the above agreement
# Rpm-ivh jdk-6u23-linux-x64-rpm.bin // select yes until installation is complete
② Install jdk-6u23-linux-x64.bin files
# Chmod 744 jdk-6u23-linux-x64.bin // give the root user the execution permission (The author installed with the ROOT user)
#./Jdk-6u23-linux-x64.bin // select yes until installation is complete

Step 3: Configure environment variables
<1> # vi/etc/profile
<2> add the following lines at the end:
Export JAVA_HOME =/usr/java/jdk1.6.0 _ 23
Export CLASSPATH =.: $ JAVA_HOME/jre/lib/rt. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
// Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar (it should be the same)


Export PATH = $ PATH: $ JAVA_HOME/bin
<3> # reboot // restart the machine. the configuration takes effect.


Step 4: Test whether java is successfully installed
# Javac
Is there any help ?~ Congratulations! you have successfully configured the JAVA environment.

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.