1, check the JDK built-in Linux has been installed # java-version2, view JDK information # rpm-qa | grepjava Display: java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxxjava-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx3, uninstall (there are several uninstall)
1. check whether the built-in JDK of Linux is installed.
# Java-version
2. View JDK information
# Rpm-qa | grep java
Display:
Java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx
Java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx
3. uninstall (several detaches are available)
# Rpm-e -- nodeps java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx
# Rpm-e -- nodeps java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx
There are other commands
Rpm-qa | grep gcj
Rpm-qa | grep jdk
If openjdk source cannot be found, you can uninstall it like this.
Yum-y remove java java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx
Yum-y remove java java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx
4. install JDK
:( JDK1.7)
Http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm
Run the following installation command in/usr/local/src:
# Rpm-ivh jdk-7u79-linux-x64.rpm
Installed in/usr/java by default
5. check for installation
# Java-version
Display: jvav version "1.7.0 _ 79"... indicates successful
6. configure environment variables
# Vi/etc/profile
Add the following lines at the end:
JAVA_HOME =/usr/java/jdk1.7.0 _ 71
CLASS_PATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
PATH = $ JAVA_HOME/bin: $ PATH
Export JAVA_HOME CLASS_PATH PATH
# Reboot machine configuration takes effect
Or execute the following command to take effect immediately
# Source/etc/profile