如安装Java 1.8
yum install java-1.8.0-openjdk.x86_64 -y
安装完成后,可能会缺一些命令,如jps
需要在安装yum install -y java-1.8.0-openjdk-devel.x86_64
[root@centos01 ~]# yum list | grep jdk-devel
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.242.b08-0.el7_7 @updates
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 base
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.251-2.6.21.0.el7_7 updates
java-1.8.0-openjdk-devel.i686 1:1.8.0.242.b08-0.el7_7 updates
java-1.8.0-openjdk-devel-debug.i686 1:1.8.0.242.b08-0.el7_7 updates
java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.242.b08-0.el7_7 updates
java-11-openjdk-devel.i686 1:11.0.6.10-1.el7_7 updates
java-11-openjdk-devel.x86_64 1:11.0.6.10-1.el7_7 updates
java-11-openjdk-devel-debug.i686 1:11.0.6.10-1.el7_7 updates
java-11-openjdk-devel-debug.x86_64 1:11.0.6.10-1.el7_7 updates
然后,jps命令可以正常执行了
[root@centos01 ~]# jps -l
8106 sun.tools.jps.Jps
查看Linux自带的jdk安装路径
[root@centos01 ~]# whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz
[root@centos01 ~]#
[root@centos01 ~]# ll /usr/bin/java
lrwxrwxrwx. 1 root root 22 Mar 5 00:30 /usr/bin/java -> /etc/alternatives/java
[root@centos01 ~]#
[root@centos01 ~]# ll /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 Mar 5 00:30 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre/bin/java