centos系统如何查看jdk安装目录

在可执行 java命令的情况下查找过程如下:

1、执行which java

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

(推荐教程:centos使用教程)

2、执行ls -lrt /usr/bin/java

[root@localhost ~]# ls -lrt /usr/bin/java
lrwxrwxrwx. 1 root root 22 10月 10 08:06 /usr/bin/java -> /etc/alternatives/java

3、执行ls -lrt /etc/alternatives/java

[root@localhost ~]# ls -lrt /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 10月 10 08:06 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.144-0.b01.el7_4.x86_64/jre/bin/java

由上可知java的路径为: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.144-0.b01.el7_4.x86_64,进入该路径查看文件如下:

[root@localhost ~]# cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.144-0.b01.el7_4.x86_64
[root@localhost java-1.8.0-openjdk-1.8.0.144-0.b01.el7_4.x86_64]# ll
总用量 4
drwxr-xr-x. 2 root root 4096 10月 10 14:53 bin
drwxr-xr-x. 3 root root 132 10月 10 14:53 include
drwxr-xr-x. 4 root root  28 10月 10 08:03 jre
drwxr-xr-x. 3 root root 144 10月 10 14:53 lib
drwxr-xr-x. 2 root root 204 10月 10 14:53 tapset
[root@localhost java-1.8.0-openjdk-1.8.0.144-0.b01.el7_4.x86_64]#

相关视频教程推荐:linux视频教程