JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH
centos7 通过yum安装Java后,查看Java安装路径
which java
2.ls -lrt /usr/bin/java
3.ls -lrt /etc/alternatives/java
Centos 7 查看使用YUM 安装的JDK路径并配置JAVA_HOME
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
使配置生效
source /etc/profile