在可执行 java命令的情况下查找过程如下:
执行which java
1
2
|
[root@localhost ~] # which java /usr/bin/java |
执行ls -lrt /usr/bin/java
1
2
|
[root @localhost ~]# ls -lrt /usr/bin/java lrwxrwxrwx. 1 root root 22 10 月 10 08 : 06 /usr/bin/java -> /etc/alternatives/java |
执行ls -lrt /etc/alternatives/java
1
2
|
[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,进入该路径查看文件如下:
1
2
3
4
5
6
7
8
9
|
[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] # |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:http://blog.devwiki.net/index.php/2017/10/10/find-jdk-path-in-centos.html?utm_source=tuicool&utm_medium=referral