0


mac安装java17(jdk17)

1. 下载jdk17

官网下载:https://www.oracle.com/java/technologies/downloads

2. 直接安装

安装完后目录会存放在下面目录下

/Library/Java/JavaVirtualMachines

111@111deMBP JavaVirtualMachines % ls
jdk-11.0.22+7    jdk-17.jdk

3. 如果你已经安装过java,需要设置环境变量更改为jdk17

vim ~/.zshrc

#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.22+7/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

运行并启动该环境变量

bash ~/.zshrc
source ~/.zshrc

4. 重新打开一个shell查看版本

command + T

java -version

java version "17.0.12" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)
标签: macos java

本文转载自: https://blog.csdn.net/u012206617/article/details/141266464
版权归原作者 墨痕诉清风 所有, 如有侵权,请联系我们删除。

“mac安装java17(jdk17)”的评论:

还没有评论