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!