-
定位
JDK
安装路径-
终端输入
which java
-
终端输出
[root@iZ8vb2e3mzflkvty6k7eraZ agent-2.4.0-release]# which java /usr/bin/java
-
终端输入
ls -lrt /usr/bin/java
-
终端输出
[root@iZ8vb2e3mzflkvty6k7eraZ agent-2.4.0-release]# ls -lrt /usr/bin/java lrwxrwxrwx 1 root root 22 Apr 8 15:43 /usr/bin/java -> /etc/alternatives/java
-
终端输入
ls -lrt /etc/alternatives/java
-
终端输出
[root@iZ8vb2e3mzflkvty6k7eraZ agent-2.4.0-release]# ls -lrt /etc/alternatives/java lrwxrwxrwx 1 root root 73 Apr 8 15:43 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64/jre/bin/java
-
-
配置JAVA_HOME
-
打开配置文件
vim /etc/profile
-
增加下面的配置
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64 export JRE_HOME=$JAVA_HOME/jre export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
-
保存退出
-
-
生效配置
source /etc/profile
-
测试配置结果
echo $JAVA_HOME
Centos7配置JAVA_HOME
最新推荐文章于 2024-06-04 20:58:04 发布