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.