客户至上、服务为根、勇于拼搏、务实创新

< 返回上层

centos查找已安装的jdk路径的方法

2020-01-15 17:43:44 来源:蓝队云

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


执行which java


[root@localhost ~]# which java

/usr/bin/java

执行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

执行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]#