1.首先通过,which java命令或whereis java命令,可以得到 /usr/bin/java
$ which java
/usr/bin/java
2.执行命令 ls -lrt /usr/bin/java 得到 /usr/bin/java -> /etc/alternatives/java
$ ls -lrt /usr/bin/java
lrwxrwxrwx 1 root root 22 1月 17 15:54 /usr/bin/java -> /etc/alternatives/java
3.执行 ls -lrt /etc/alternatives/java 得到 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
$ ls -lrt /etc/alternatives/java
lrwxrwxrwx 1 root root 46 4月 6 15:28 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
4.执行 ls -lrt /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 得到 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
ls -lrt /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
-rwxr-xr-x 1 root root 14632 1月 20 11:59 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
所以,jdk的安装路径就是:/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
5.执行 cd /usr/lib/jvm ,cd到目录下查看相关安装文件
参考:
linux如何到jdk的目录,如何找linux上的JDK目录
Linux如何查看JDK的安装路径