mac安装jdk
一,下载jdk
二,安装jdk
一路next就好
# 查安装地址
/usr/libexec/java_home -V
三,环境变量
# 进入~/目录下面
cd ~/
# 按需创建.bash_profile
touch .bash_profile
# 打开.bash_profile
open -e .bash_profile
# 在.bash_profile增加配置
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin:.
export CLASSPATH=$JAVA_HOME/lib/tools.jar:
# 生效配置
source .bash_profile