MacBook安装jdk8

MacBook安装jdk8

官方下载地址: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
下载macOS x64版本: jdk-8u171-macosx-x64.dmg


#点击安装
jdk-8u171-macosx-x64.dmg
安装完成后

#设置环境变量
vim ~/.zshrc 
#最后加入
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH

#保存退出

#使配置生效 
source ~/.zshrc

#显示刚配置的路径
echo $JAVA_HOME 

#查看版本
java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

参考链接: https://blog.csdn.net/vvv_110/article/details/72897142

你可能感兴趣的:(mac,macbook,jdk1.8)