1、 查java命令位置:

[root@localhost ~]# which java
/usr/bin/java
[root@localhost ~]# 

2、查软链:

[root@localhost ~]# ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 4月  30 14:42 /usr/bin/java -> /etc/alternatives/java
[root@localhost ~]# 

3、查jdk目录:

[root@localhost ~]# ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 4月  30 14:42 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64/jre/bin/java
[root@localhost ~]# 

 

jdk目录是 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el7_9.x86_64