Uninstalling and install the JDK in centos

Under normal circumstances, we will Linux bring OPENJDK to uninstall and install SUN’s JDK

First: check Linux native JDK is installed
<1>#//view the installed JAVA version information
General will receive the following message:
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># |grep view JDK Java//information吐舌头
General will receive the following message:
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># 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

Does it feel too long??? , * This symbol will be used?大笑

Step two: install SUN’s JDK
<1> download JDK-6u23-Linux-x64-RPM.bin or JDK-6u23-Linux-x64.bin from the SUN JDK
Create new Java under/usr folder, packages will be installed in the/usr/java directory
# mkdir /usr/java

得意Default is under the usr directory, you can enter/usr/local/JDK
<2> install JDK
# cd /usr/java
① JDK-6u23-Linux-x64-RPM.bin file is installed
# Chmod 777 JDK-6u23-Linux-x64-RPM.bin//modify executable
#./JDK-6u23-Linux-x64-RPM.bin//select Yes agree with the above agreement
# JDK-6u23-Linux-x64-RPM.bin//selecting Yes until the installation is complete
② JDK-6u23-Linux-x64.bin file is installed
# Chmod 744 JDK-6u23-Linux-x64.bin//the root user has the Execute permission (I installed by the ROOT user)
#./JDK-6u23-Linux-x64.bin//selecting Yes until the installation is complete

Step three: Configure the environment variable
<1># vi /etc/profile
<2> add the following lines:
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 (can)
export PATH=$PATH:$JAVA_HOME/bin
<3># reboot//restart the machine configuration takes place

Fourth step: test whether Java is installed successfully
#javac
Is there help out? ~ Oh, and congratulations on your JAVA environment is configured successfully