🌐
BellSoft
bell-sw.com › announcements › 2021 › 03 › 12 › Liberica-on-Apple-Silicon
Liberica JDK offers native Java builds for Apple Silicon M1 | BellSoft Java
January 31, 2023 - Liberica JDK for M1 is a production-ready TCK-verified binary. Try BellSoft’s progressive Java runtime for modern deployments and fully experience its benefits for macOS users. ... For the latest JDK release on macOS, BellSoft offers a choice ...
🌐
Oregon State University
blogs.oregonstate.edu › cornercase › 2022 › 04 › 21 › the-apple-m1-and-java
The Apple M1 and Java – Corner Case
The M1 itself is an ARM-based SoC (System on a Chip). It’s their first RISC (Reduced Instruction Set Computing – and no pun intended). It has both a CPU and GPU on the same block. Its architecture differs drastically from the old Intel-based Macbooks. These are breaking and significant ...
Discussions

java - How to compile OpenJDK 11 on an M1 Macbook? - Stack Overflow
Fwiw the error most likely indicates you're trying to build for 32-bit ARM, m1 is ARM64. ... If the reason behind your question (or others like me coming here) is simply since Oracle does not have an M1 version of the jdk11, just download the linux version for arm (ARM 64 Compressed Archive). More on stackoverflow.com
🌐 stackoverflow.com
macos - How to handle java apps lacking ARM support using java SDK on M1 Mac? - Ask Different
I wish to run an app written in Java on an M1 Mac (running Monterey 12.0.1, as it happens). The app contains at least one .jar file with a universal mac binary containing only an i86 fork, no arm fork · this app worked with the Oracle JRE (Java 8 Update 311) but once I installed Oracle's JDK 17 ... More on apple.stackexchange.com
🌐 apple.stackexchange.com
November 27, 2021
How to install java on Mac m1?
I read somewhere last week that there is a new M1 version of Java runtime coming. But I could not find it today when I searched. More on reddit.com
🌐 r/MacOS
15
6
September 29, 2021
Provide JDK/JRE 8 and 11 builds for Apple Silicon (M1/ARM/aarch64)
Currently only JDK 17 has builds for Apple Silicon (M1/ARM/aarch64) This request is to provide JDK/JRE 8 and 11 builds for Apple Silicon (M1/ARM/aarch64) References: Azul OpenJDK JRE and JDK 8 macO... More on github.com
🌐 github.com
29
November 1, 2021
🌐
rieckpil
rieckpil.de › home › java tutorials › java development on an apple sillicon (m1, m2, m3, arm64)
Java Development on an Apple Sillicon (M1, M2, M3, ARM64) | rieckpil
March 18, 2024 - While searching for a arm64 compatible JDK back in 2021, the Azul Zulu JDK build popped up first. There’s no difference in the installation process of a JDK compared to an x64 Mac.
🌐
Kev's Development Toolbox
kevinhooke.com › 2021 › 10 › 30 › java-jdk-builds-for-m1-arm
Java JDK builds for M1 ARM – Kev's Development Toolbox
October 30, 2021 - Right now it looks like there’s 2 options for a native M1 JDK: Microsoft JDK 17 · Azul OpenJDK 17 · Microsoft have JDK 17 builds for Windows, Linux and MacOS on x86, ARM64, and Apple M1: Azul have OpenJDK builds also for Windows, Linux and ...
🌐
Oracle
oracle.com › java › technical details
JDK 8 for ARM - Download
Please visit our JDK 8 download page to get the latest version of the JDK for ARM.
🌐
Gunnar Morling
morling.dev › blog › running-jmc-on-apple-m1
Running JDK Mission Control on Apple M1 - Gunnar Morling
May 17, 2022 - "temurin-17.jdk" is my default JDK; it’s the Java 17 build provided by the Eclipse Temurin project for macOS/AArch64, i.e. the right one for the ARM chip of the M1 ("Apple silicon"). The error message isn’t overly helpful; after all, that referenced JDK works just fine for all my other ...
🌐
Pangea.ai
pangea.ai › resources › setting-up-java-development-for-mac-m1
Setting up Java Development for Mac M1 | Pangea.ai
December 5, 2025 - Most providers have gotten around to producing an ARM build of their software today and for the rare exceptions that haven't then the emulated x64 version on Mac works without issue pretty much universally. Having the knowledge and experience of troubleshooting JDK issues and understanding how the language works under the surface are invaluable skills that every Java developer should have at their disposal.
Top answer
1 of 4
16

tl;dr

target (64) differs … number of bits … in the target (32)

Apple Silicon chips for macOS (M1, M2) are all 64-bit architectures. Do not compile for 32-bit.

I want to compile jdk in M1 MacBook.

Do not try to compile OpenJDK. Codebase is large and complicated. And no need, as others provide binaries & installers.

For a Mac using Apple Silicon rather than Intel x86-64, I suggest obtaining a distribution of Java 17 for macOS / AArch64, released 2021-09, from any of several vendors.

Or, use a build of earlier versions of Java ported to Apple Silicon by various vendors. For example, Azul Systems announced 2020-11 plans to ship builds of OpenJDK 8 and 11 for Apple Silicon, ARM-based Macs. I see downloads available now from that company for Java 11.0.13+8 on both Intel Macs and Apple Silicon Macs.

Details

Few of us ever compile the very large and complicated codebase of OpenJDK. Instead, we look to any of several vendors providing builds and installers. If your goal is to be productive in Java programming, then compiling the Java JDK toolset is not the best use of your time.

Java 17 was released 2021-09. OpenJDK officially supports macOS on Apple Silicon: JEP 391: macOS/AArch64 Port. You have your choice of builds/installers from any of several vendors such as SAP, Red Hat/IBM, BellSoft, Azul Systems, Oracle, Adoptium/AdoptOpenJDK, Microsoft, Amazon, Pivotal, and more. These builds/installers will be based largely or entirely on the OpenJDK codebase.

Vendors such as Azul Systems provide Apple Silicon builds for the current version 19 as well as the long-term support (LTS) versions 8, 11, and 17. Java 17 is the latest LTS version, to be supported for many years. So I would suggest Java 17 for deployment.

I myself have been using Java 17, 18, and 19, as well as early-access 20, on a couple of M1 MacBook Pro laptops with IntelliJ and Maven on Big Sur & Monterey. Working well, no problems.

Update: As of 2023-11, I would suggest the current version 21 for deployment, as it is the latest LTS version. Also, you can now obtain JDK binaries and installers from many vendors, including Amazon, Microsoft, Azul Systems, BellSoft, Oracle, Adoptium, SAP, IBM, Red Hat, Linux apt-get, FreeBSD Ports and Packages, and more. Most of these provide editions of their JDK products for both Intel Macs and Apple Silicon Macs.

Compiling Java

As commented, your specific error is likely due to you compiling for 32-bit ARM rather than 64-bit ARM architecture used by Apple for their M1 chip and M2 chip families.

If you are curious about, or have an academic interest in compiling Java from the OpenJDK codebase, I suggest examining the open-sourced tooling at Adoptium (formerly AdoptOpenJDK). The tooling for building early-access builds at the OpenJDK site may also be open-sourced but I don’t know for certain.

2 of 4
5

You can build OpenJDK 11.0.12 on an M1 MacBook, with the help of Homebrew, by running:

brew install --build-from-source --verbose openjdk@11

Xcode is a prerequisite, you can download it from there https://developer.apple.com/download/more/ (Apple ID needed).

You probably also have to run:

xcode-select --install
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

I've tested it and it builds perfectly.

Find elsewhere
Top answer
1 of 2
4

The issue here is that you are calling a C library via jogamp The C library provided (I think OpenGL) is Intel only.

Oracle's JDK and JRE are not universal (see the downloads page) i.e. they only do one architecture. Similarly the OpenJDKs are not universal.

Thus to run on ARM and Intel you need two different JREs

Pure Java code should run on any operating system (Linux, Solaris, Windows, macOS and others) and on any architecture e.g. Intel, Arm, SPARC. So you only need one jar for all.

The C code could be built universal and your app could be packaged to include both JREs and the launcher (i.e. executable file given in Info.plist) works out from the architecture which JRE to call)

Java 8 worked as it is Intel and so the whole process ran under Rosetta

2 of 2
0

If you install the ARM JDK and find it breaks some app using e.g. gluegen, the simplest solution is to install the Intel JDK.

In particular, if you installed the ARM JDK to the default location using the disk image from Oracle's site, you can do precisely the same thing with the Intel JDK. This will effectively overwrite the ARM JDK.

Don't try simply installing the (Intel) JRE on top of the mess. That does NOT work - the JRE built-into the ARM JDK somehow persists. (And following Oracle's instructions for deleting Java before re-installing the JRE won't help either.)

According to Oracle's site, it's possible in theory to install multiple JDK's each in their own location, and switch between them. That would probably also work, but I haven't tried it.

🌐
Reddit
reddit.com › r/macos › how to install java on mac m1?
r/MacOS on Reddit: How to install java on Mac m1?
September 29, 2021 - I have found, Zulu has M1 Silicon Optimised OpenJDK which no longer requires Rosetta support. https://www.azul.com/downloads/?version=java-11-lts&os=macos&architecture=arm-64-bit&package=jdk More replies More replies More replies · [deleted] • 4y ago · Does this help?
🌐
Medium
sudarakayasindu.medium.com › installing-openjdk-on-m1-macbook-pro-4188ce3f9cf0
Installing OpenJDK on M1 Macbook Pro | by Sudaraka Jayathilaka | Medium
June 19, 2023 - So now I dug up a bit and found the solution. azul.com provides OpenJDK versions built for ARM 64-bit architecture. You can download the dmg from HERE 👋 · Problem solved 😎 · Java · Jdk · Openjdk · MacBook · M1 · 89 followers · ·25 following · Gopher 💻 Cloud ☁️ Distributed Computing 🖥 ·
🌐
Code2care
code2care.org › home › q › install native java jdk jre on apple silicon m1 mac
Install Native Java JDK JRE on Apple Silicon M1 Mac | Code2care
January 26, 2026 - If you want to run Java JDK or JRE natively on M1 Mac you can make use of Azul Zulu Builds for Java JDK/JREs, Go to: https://www.azul.com/downloads/zulu-community/?package=jdk if you want to install JDK or https://www.azul.com/downloads/zul...
🌐
Medium
medium.com › @chamin.njay › install-jdk-on-arm-based-macos-b070f211df6a
Install JDK on ARM based macOS. Java Development Kit (JDK) is an… | by Chamin Jayasooriya | Medium
April 13, 2023 - Find the JDK version you want to download under the “Azul Zulu” tab. Select “macOS ARM 64-bit” and download it as a zip file.
🌐
GitHub
github.com › adoptium › adoptium › issues › 96
Provide JDK/JRE 8 and 11 builds for Apple Silicon (M1/ARM/aarch64) · Issue #96 · adoptium/adoptium
November 1, 2021 - Currently only JDK 17 has builds for Apple Silicon (M1/ARM/aarch64) This request is to provide JDK/JRE 8 and 11 builds for Apple Silicon (M1/ARM/aarch64) References: Azul OpenJDK JRE and JDK 8 macOS ARM builds Azul OpenJDK JRE and JDK 11...
Author   adoptium
🌐
GitHub
github.com › sdkman › sdkman-cli › issues › 1068
Question: Install x86 JDK on M1 Mac · Issue #1068 · sdkman/sdkman-cli
March 14, 2022 - Hi all, for a specific project I need an x86 JDK (version 11 or 13 prefered) installed on my M1 MacBookPro. More precisely I need nd4j and javacpp which are not available for Arm64 yet and maven tries to retrieve macosx-arm64 versions th...
Author   sdkman
Top answer
1 of 16
211

A command line approach (thanks to the Homebrew team and the hard work of @vladimir-kempik and other openjdk contributors on the JEP-391 branch)

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install OpenJDK
brew install openjdk

Verify it's installed:

$(brew --prefix openjdk)/bin/java --version

Verify it's for the arm64 hardware:

file $(brew --prefix openjdk)/bin/java     
# /opt/homebrew/opt/openjdk/bin/java: Mach-O 64-bit executable arm64

Note: To install openjdk system-wide, follow the on-screen instructions provided by Homebrew.

2 of 16
127

Yes.

On this page: AdoptOpenJDK Latest Releases you can select 'macOS' from the 'Operating System' dropdown, and then from 'Architecture', it's currently only x64, but soonish there should be AArch64 or ARM64 (those are usually the shortcodes for 64-bit ARM). Possibly, as Apple no doubt has a bunch of extensions built into their M1 designs, and Apple gets its own.

If you instead leave Operation System on 'any', you'll note aarch64 is in there, and this gets you to a Linux release for ARM processors. That (probably) won't run on macOS on M1 hardware, but that's 95% of the work already done.

So: It's not there yet, but note that JDKs for ARM have been available for more than decade, and whilst JDK 15 has dropped support for a bunch of exotic OS/architecture combinations (such as Solaris), ARM development has always remained at least partially relevant (even if so far it's mostly an Oracle commercial license offering). That is to say: It should not be a herculean effort to create an adoptopenjdk release that runs on M1s natively, so presumably, it will happen. But, it's an open source effort, so if you're anxious, by all means, read up and contribute :)

Apple has not given any details on this architecture whatsoever until November 10th 2020, unless you bought a development kit box for it (a Mac Mini with an A14 chip, which isn't an M1 chip, but close enough I guess), and signed a big NDA.

As a rule, open source projects will run as fast as possible in the opposite direction if you wave an NDA around, so if you dislike this state of affairs, I don't think it's wise to complain to adoptopenjdk or other packagers and open source projects about it :)

Fortunately, now it's out, and an NDA is no longer required. My assumption is that the ARM branch of the OpenJDK source code + the macOS bits that already exist for the macOS x64 release can be combined rather easily once someone with some familiarity with the OpenJDK source code has an M1-based macOS system to test it on, which should mean an adoptopenjdk macos-aarch64 release should be here within the month.

But, open source. You didn't pay them, you have no contract, and they don't owe it to you. Donate to the effort or contribute a pull request if you want it to go faster.

UPDATE:

  • Azul's M1 OpenJDK builds
  • Microsoft's (yes, really) GitHub source repo for an early access OpenJDK16 build for macOS on AArch64. Note that Microsoft's been working on the OpenJDK branch of AArch64 (for ARM-based Windows 10) for a while, which goes back to: A lot of the hard work was already done.
🌐
GitHub
github.com › AdoptOpenJDK › homebrew-openjdk › issues › 530
Provide native builds for M1 Apple Silicon (ARM) Macs in Homebrew · Issue #530 · AdoptOpenJDK/homebrew-openjdk
May 3, 2021 - AdoptOpenJDK now includes a build for the new M1-based (Apple Silicon) Macs. Ideally, the Homebrew package should provide this ARM based build when being installed on an Apple Silicon Mac rather than relying on Rosetta 2 to run the JDK. ...
Author   AdoptOpenJDK
🌐
Apple Community
discussions.apple.com › thread › 253536115
mac m1 compile open jdk - Apple Community
January 6, 2022 - Then building openjdk on an M1 is not something you want to attempt at this time. There seem to be a couple of different binaries available from: https://www.azul.com/newsroom/azul-announces-support-of-java-builds-of-openjdk-for-apple-silicon/ ... Based on that, you will want to build JDK 17 or JDK 18, using macOS 11.2 or later, and with Xcode 12.4.