1. Uninstall JDK
The JDK is provided in Linux. If the built-in version is not used, uninstall it.
1. Uninstall the built-in JDK version.
View the built-in JDK
# Rpm-Qa | grep gcj
The following information is displayed:
Libgcj-4.1.2-44.el5
Java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Run the rpm-e -- nodeps command to delete the content found above:
# Rpm-e -- nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
2. Uninstall the jkd version installed by rpm
View the installed JDK:
# Rpm-Qa | grep JDK
The following information is displayed:
Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
Uninstall:
# Rpm-e -- nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
Ii. Install JDK
First download the installation package from the sun official website. The following is the latest installation package.
Http://java.sun.com/javase/downloads/index.jsp
If you want to find a previous version, you can find it at the address below
Http://java.sun.com/products/archive/
There are two versions of jdk-6u7-linux-i586-rpm.bin and jdk-6u7-linux-i586.bin
What are the differences between the two versions? What does RPM mean?
Bin is a binary package, while RPM is a RedHat package, which is the standard installation package of Red Hat.
The difference is that the RPM is automatically configured during installation. Generally, Lib is installed to/usr/lib bin and installed to/usr/bin. Even if it is not, you must also establish a soft connection under/usr/bin.
The following uses the latest version of jdk-7u3-linux-i586.rpm as an example to install:
Place the installation file in the/usr/Java directory and modify the permission. The command is as follows (you must use the CD command to switch to the corresponding directory ):
# Chmod + x jdk-7u3-linux-i586.rpm
Install the execution file:
# Rpm-IVH jdk-7u3-linux-i586.rpm
3. Configure Environment Variables
Modify the/etc/profile file and add
Export java_home =/usr/Java/jdk1.7.0 _ 03
Export Path = $ path:/usr/Java/jdk1.7.0 _ 03/bin
Save
Iv. Execution
CD/etc
Source Profile