Linux下查找JDK默认安装路径

 2020-02-06 11:23:41  1388  收藏 2

一、查找效果图

 

 

二、查找步骤

1、首先确认是否已按照JDK
java -version

[root@iZ2ze3zda3caeyx6pn7c5zZ base-eureka]# java -version
openjdk version “1.8.0_212”
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

2、然后查找java命令的位置

which java

[root@iZ2ze3zda3caeyx6pn7c5zZ base-eureka]# which java
/usr/bin/java

3、查找java命令的位置所对于的软链地址

ls -l /usr/bin/java

[root@iZ2ze3zda3caeyx6pn7c5zZ base-eureka]# ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Jun 18 15:45 /usr/bin/java -> /etc/alternatives/java

4.最后通过软链地址查找JDK的安装目录

ls -l /etc/alternatives/java

[root@iZ2ze3zda3caeyx6pn7c5zZ base-eureka]# ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 73 Jun 18 15:45 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/bin/java