Mac computer M1 chip installation Java environment stepping pit record

I have used mac to configure the java environment before, but it is not much different from windows. This time I bought a mac with M1 chip, which really stepped on a wave of pitfalls.

First of all, IDEA is downloaded from the official website, and the latest version is used. It is okay to crack it, mainly because jdk is a big pit.

I first downloaded the highest version of 1.8, version 1.8.0_335, from Oracle's official website. After installation, I configured environment variables. The code could run, but when I packaged it, I always reported a compilation error of maven-compiler-plugin:3.8.1:compile.

At first I thought it was a problem with the maven version. After changing several versions, I found that it had nothing to do with maven. I thought it might be a problem with jdk. Finally, through Baidu, I found that a small partner had encountered a similar problem and told Zulu that the JDK packaged by Zulu supports the M1 chip. , so go to the official website to download Zulu jdk 8 and install it, download address: Java Download

Double click to install

After the installation is complete, you can see zulu-8.jdk in the /Library/Java/JavaVirtualMachines/ directory, which means the installation is successful

Then configure environment variables

JAVA_HOME="/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home"
CLASS_PATH="$JAVA_HOME/lib"
PATH=".$PATH:$JAVA_HOME/bin"
export JAVA_HOME
export PATH
export CLASS_PATH

Configure maven configuration refer to another article Mac configuration Maven environment and setting.xml, maven warehouse, etc.

Guess you like

Origin blog.csdn.net/songyun333/article/details/127632703