Mac M1 Java 开发环境配置

JDK 配置

目前 Zulu JDK 支持 M1芯片,下载 Download Azul Zulu Builds of OpenJDK | Azul

下载后点击安装,在控制台输入java -version

~ % java -version
openjdk version "11.0.10" 2021-01-19 LTS
OpenJDK Runtime Environment Zulu11.45+27-CA (build 11.0.10+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.45+27-CA (build 11.0.10+9-LTS, mixed mode)

多版本 JDK

下载不同版本安装即可,Zulu JDK默认安装在/Library/Java/JavaVirtualMachines目录下,配置 JAVA_HOME切换 JDK版本, 修改~/.zshrc文件,(Mac M1 2020 版默认使用的是zsh)没有创建一个, 将配置加入到文件末尾

# export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home

MAVEN 配置

下载maven, 解压后移动到 /opt目录下(不移动到/opt下也行),配置MAVEN_HOME, 修改~/.zshrc文件, 将配置加入到文件末尾

export MAVEN_HOME=/opt/apache-maven-3.6.3

export PATH=$PATH:$MAVEN_HOME/bin

控制台输入mvn -version

~ % mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven-3.6.3
Java version: 11.0.10, vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
Default locale: zh_CN_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "11.2", arch: "aarch64", family: "Mac"

VSCODE

目前只有内部版本支持M1 Download Visual Studio Code Insiders

IDEA

已支持M1 IDEA

你可能感兴趣的:(Mac M1 Java 开发环境配置)