Install Java on yum in CentOS and Java on CentOSyum
Check whether the built-in JDK of CentOS is installed.
◆ Input: yum list installed | grep java.
If a built-in JDK is installed, how does one uninstall the built-in Java environment of CentOS?
◆ Uninstall JDK file input: yum-y remove java-1.7.0-openjdk *.
◆ Uninstall tzdata-java input: yum-y remove tzdata-java.noarch.
When the result is displayed as Complete! The uninstallation is complete.
Note: "*" indicates that all openjdk related files of java 1.7.0 are uninstalled.
Check whether the network connection of the CentOS system is normal.
◆ To use yum for installation, you need to connect to the network to download the corresponding Java installation file. Therefore, you need to use the ping command to test the network. For example, ping Baidu URL.
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
Extras | 3.4 kB: 00
Updates | 3.4 kB: 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
Using sist. noarch 3.9.0-6. el6 base
Javassist-javadoc.noarch 3.9.0-6. el6 base
Take java-1.7.0 In the yum library as an Example
Note: "*" indicates that all java programs related to Java-1.7.0 are installed.
[Root @ beta-new1 www] # yum-y install java-1.7.0-openjdk *
View the installed Java version.
◆ Enter java-version to view the Java version;
◆ Enter javac to view the Java compiler command usage.