linux 查看JAVA_HOME,配置环境变量
[zt@zt-mid01 ~]$ echo $JAVA_HOME
1、查看jdk 安装目录
[root@ali-zt-04 ~]# [root@ali-zt-04 ~]# java -version java version "1.8.0_261" Java(TM) SE Runtime Environment (build 1.8.0_261-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode) [root@ali-zt-04 ~]# [root@ali-zt-04 ~]# which java /usr/bin/java [root@ali-zt-04 ~]# ls -lrt /usr/bin/java lrwxrwxrwx 1 root root 22 Mar 2 19:08 /usr/bin/java -> /etc/alternatives/java [root@ali-zt-04 ~]# [root@ali-zt-04 ~]# ls -lrt /etc/alternatives/java lrwxrwxrwx 1 root root 37 Mar 2 19:08 /etc/alternatives/java -> /usr/java/jdk1.8.0_261-amd64/bin/java [root@ali-zt-04 ~]#
安装路径【/usr/java/jdk1.8.0_261-amd64/bin/java】
2、配置jdk 环境变量
[root@ali-zt-04 ~]# vi /etc/profile
配置:
export JAVA_HOME=/usr/java/jdk1.8.0_261-amd64 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
profile生效
source /etc/profile
转自:
本文来自博客园,作者:天军,转载请注明原文链接:https://www.cnblogs.com/h2285409/p/16691062.html