经常我们需要查找java的安装路径,
whereis java
java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
➜ pet whereis java
/usr/bin/java
ls -l java
wtx@ubuntu03:~$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 9月 13 00:23 /usr/bin/java -> /etc/alternatives/java
ls -l
wtx@ubuntu03:~$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 46 9月 13 00:23 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
最后可以得知路径在 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java