Mac安装jdk17和jdk18
一、下载jdk17和jdk18
jdk17和jdk18下载地址:https://www.oracle.com/java/technologies/downloads/#jdk18-mac
二、点击安装jdk-18_macos-x64_bin.dmg
默认安装即可
三、查看jdk18是否安装成功
java -version
java version "18.0.1.1" 2022-04-22
Java(TM) SE Runtime Environment (build 18.0.1.1+2-6)
Java HotSpot(TM) 64-Bit Server VM (build 18.0.1.1+2-6, mixed mode, sharing)
四、设置环境变量
vim ~/.bash_profile
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/jrt-fs.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
版权声明:本文为zhengzaifeidelushang原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。