文章目录
快速定位JDK的位置,Linux下可执行命令:
Linux下:
$(dirname $(dirname $(readlink -f $(which javac))))
Mac下:
$(dirname $(readlink $(which javac)))/java_home
ps:设置JAVA环境变量
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar