[root@lb01 ~]# java -version openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
查看环境变量:
[root@lb01 ~]# echo $JAVA_HOME
(为空)
查找java:
[root@lb01 ~]# which java /usr/bin/java [root@lb01 ~]# ls -lrt /usr/bin/java lrwxrwxrwx. 1 root root 22 Oct 25 2019 /usr/bin/java -> /etc/alternatives/java
查看超链接可知道环境变量信息:
[root@lb01 ~]# ls -lrt /etc/alternatives/java lrwxrwxrwx. 1 root root 71 Oct 25 2019 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre/bin/java
所以java环境变量是:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/