Install Native Java JDK on Apple Silicon M1 Mac

If you are using M1 Macbook or Mac mini computer, you must have noticed that Java from Oracle is not yet build for M1 Silicon chip yet! It only make use of Rosetta 2, you would see that the performance will take a hit.

Download Native Java JDK

Base on openJDK, azul provide the M1 native version of JDK. So, let’s download the installation package firstly.

Go to: https://www.azul.com/downloads/?package=jdk

Select Java Version: (8, 9, 10, 11, 12, 13, 14, 15)
Select Operating Sytem: macOS
Select Architecture: ARM-64
You will get links to download the setup as zip/dmg/tar.gz format - download anyone you prefer.

Installation

If you download the dmg package the installation is quite simple - Double click on Zulu.dmg file and on the popup click on “Double-Click to install Zulu X.x.x.x and follow the installation.

Verifiy

Open a terminal, execute the following command:

1
java -version

You may get the following information:

1
2
3
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)

How to switch between different versions of Java

If you need use the different versions of Java in the same machine, you can install the different versions of Java, like Java 8 and Java 17. And you can switch them anytime easily. Specific methods can be referred to How to set JAVA_HOME in MacOS Big Sur

本文标题:Install Native Java JDK on Apple Silicon M1 Mac

文章作者:Morning Star

发布时间:2021年07月11日 - 22:07

最后更新:2022年01月28日 - 08:01

原始链接:https://www.mls-tech.info/java/java-install-native-jdk-on-apple-silicon-m1/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。