See if the CentOS has been installed with its own JDK.
Input: Yum list installed |grep java.
How to uninstall the CentOS system with its own Java environment if you have an installed JDK.
Uninstall JDK related file input: yum-y remove java-1.7.0-openjdk*.
Uninstall Tzdata-java Input: Yum-y remove Tzdata-java.noarch.
When the results are displayed as complete. That is, uninstall is complete.
Note: "*" means to uninstall all OPENJDK related files of the Java 1.7.0.
Check that the CentOS system network connection is normal.
Use the Yum way to install the need to connect the network download Java corresponding installation files, so you need to use ping to test the network, such as: ping Baidu URL can be.
View the Java installation package in the Yum Library.
Input: Yum-y list java*.
[Root@beta-new1 www]# yum-y list java*
Loaded Plugins:fastestmirror
Loading mirror speeds from cached hostfile
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates:centos.ustc.edu.cn
Base | 3.7 KB 00:00
Extras | 3.4 KB 00:00
Updates | 3.4 KB 00:00
Available Packages
java-1.5.0-gcj.x86_64 1.5.0.0-29.1.EL6 Base
java-1.5.0-gcj-devel.x86_64 1.5.0.0-29.1.EL6 Base
java-1.5.0-gcj-javadoc.x86_64 1.5.0.0-29.1.EL6 Base
java-1.5.0-gcj-src.x86_64 1.5.0.0-29.1.EL6 Base
java-1.6.0-openjdk.x86_64 1:1.6.0.40-1.13.12.6.el6_8 Updates
java-1.6.0-openjdk-demo.x86_64 1:1.6.0.40-1.13.12.6.el6_8 Updates
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.40-1.13.12.6.el6_8 Updates
java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.40-1.13.12.6.el6_8 Updates
java-1.6.0-openjdk-src.x86_64 1:1.6.0.40-1.13.12.6.el6_8 Updates
java-1.7.0-openjdk.x86_64 1:1.7.0.111-2.6.7.2.el6_8 Updates
java-1.7.0-openjdk-demo.x86_64 1:1.7.0.111-2.6.7.2.el6_8 Updates
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.111-2.6.7.2.el6_8 Updates
Java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.111-2.6.7.2.el6_8 Updates
java-1.7.0-openjdk-src.x86_64 1:1.7.0.111-2.6.7.2.el6_8 Updates
java-1.8.0-openjdk.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-debug.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-demo.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-headless-debug.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
Java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.101-3.b13.el6_8 Updates
Java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-src.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.101-3.b13.el6_8 Updates
java_cup.x86_64 1:0.10K-5.EL6 Base
java_cup-javadoc.x86_64 1:0.10K-5.EL6 Base
java_cup-manual.x86_64 1:0.10K-5.EL6 Base
javacc.x86_64 4.1-0.5.EL6 Base
javacc-demo.x86_64 4.1-0.5.EL6 Base
javacc-manual.x86_64 4.1-0.5.EL6 Base
Javassist.noarch 3.9.0-6.EL6 Base
Javassist-javadoc.noarch 3.9.0-6.EL6 Base
Taking java-1.7.0 in Yum library as an example
Note: "*" indicates that all relevant Java programs for the java-1.7.0 are installed.
[Root@beta-new1 www]# yum-y Install java-1.7.0-openjdk*
View the Java version information that you just installed.
Input: Java-version can view Java version;
Input: Javac To view java compiler command usage