1、查找路径
[root@master01 jre]# which java /bin/java [root@master01 jre]# ls -l /bin/java lrwxrwxrwx. 1 root root 22 Mar 22 01:01 /bin/java -> /etc/alternatives/java [root@master01 jre]# ls -l /etc/alternatives/java lrwxrwxrwx. 1 root root 73 Mar 22 01:01 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre/bin/java
2、配置JAVE_HOME
vi /etc/profile
插入:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre export PATH=$PATH:$JAVA_HOME/bin
3、使配置生效
source /etc/profile