which java
首先要申明一下which java是定位不到安装路径的。which java定位到的是java程序的执行路径。
[root@localhost ~]# which java
/usr/bin/java
[root@localhost ~]# ls -lrt /usr/bin/java
lrwxrwxrwx. 1 root root 22 Aug 17 15:12 /usr/bin/java -> /etc/alternatives/java
[root@localhost ~]# ls -lrt /etc/alternatives/java
lrwxrwxrwx. 1 root root 46 Aug 17 15:12 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
上诉 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java 就是jdk的位置了