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.
Answer from tresf on Stack OverflowA 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.
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.
Videos
Hey, I don’t know which version of Java I have to download to get Java on my MacBook Pro with M1 chip. I need Java to use Scala in Intellij (it says to make sure I have the Java 8 JDK). I have tested in the terminal, that Java is not installed on my computer (I wrote java -version and javac -version). I hope someone can help :-)
Homebrew does not support OpenJDK@8 on Apple Silicon (M1/M2) but Zulu Community 8 is present as a cask. You just have to enable cask-versions repository and install zulu8 cask.
brew tap homebrew/cask-versions
brew install --cask zulu8
It will install the JDK in /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home. You should then configure your JAVA_HOME variable for development tools to use it.
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Please note that Zulu Community 8 will only be supported until March 2026.
Rosetta 2
You can run Java for Intel Macs on Apple Silicon (ARM, Aarch64) via Rosetta 2.
Choice of JDK vendors
But for maximum performance, obtain an implementation of Java 8 built for Apple Silicon Macs.
Arm64 jdk-8 is currently unavailable currently.
Not true.
You have a choice of JDK vendors.
I know Azul Systems provides JDK products for Java 8 on both Mac’s with Intel and Macs with Apple Silicon M1/M2/M3.
Try these vendors providing JDK products, to see if they offer Java 8 on Apple Silicon Macs:
- Adoptium
- Azul Systems
- Microsoft
- Amazon
- SAP
- BellSoft
- Oracle
- IBM
- Red Hat
- … and more
SDKMAN!
I enjoy using the console app SDKMAN! to easily find, download, install, and uninstall JDKs from a subset of the vendors listed above.
Works with simple command-line instructions such as:
sdk list java
… and:
sdk install java specific_product_identifier_pasted_here
I'm absolutely new to Apple computers, and I recently bought an M1 MacBook Air.
I've been trying to setup Java JDK and JRE so I can use 'sudo apt' commands. I installed it directly from the Oracle website, but it still wouldn't let me run sudo apt commands (The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt)
I then found out about Azul, which has a version of JDK/JRE for the M1 architecture, so I went to their website and downloaded and installed the JDK and JRE for MacOS ARM 64. However, I still get the same error when I try to run the sudo apt command.
I'm very new to all this, should I be running the terminal in a specific folder or something? Any help would be appreciated, as I need this for my University work. Thanks!
I am currently taking an intro to Java class for college. I’m trying to download Java from oracle. I have a MacBook Air and my chip is an apple M2. Which download is preferred? I have four download options
Arm 64 Compressed archive
Arm 64 DMG Installer
x64 Compressed Archive
x64 DMG Installer
I just need help in order to begin the class. I will delete the post once I get the help. Please and thank you