I am not a mac user, and also not an experienced Java dev. For some reason I am having a hard time finding a consistent approach for install java on mac.
I am using it to build an Android app (using CLI not Android Studio), and require Java 11.
What is the most pain free way to install Java 11 on mac such that Android dev will work?
macos - Java/JDK for the Apple Silicon chips - Stack Overflow
How to install java on Mac m1?
Obtain Java 11 for macOS? - Ask Different
Installing Java via Homebrew
Videos
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.
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.
tl;dr
If you are an end-user needing a free-of-cost JVM to run a Java app on your Mac (rather than a developer), my personal recommendation is to download an .pkg file from AdoptOpenJDK.

Open that file to run a macOS installer.

You will then find a JVM installed in /Library/Java/JavaVirtualMachines. Later, you can upgrade in the same manner, deleting the old JVM from that folder.

Details
Yes, there have been several major changes to the evolution of Java in recent years, and they can be a bit confusing.
Multiple vendors, both free and paid
First, know that there are new options available for those wishing to pay for commercially supported implementations of Java. And know that Java is still available freely without cost. For both a summary as well as the gory details, read this white paper published by major figures in the Java community: Java Is Still Free
OpenJDK
Secondly, know that all releases for Java 11 and later for macOS are based on the same codebase, the open-source project known as OpenJDK.
Apple contributes Mac-specific code to this project, and has staff working on this to make sure that Java continues to work well on macOS.
IBM, Oracle, and many other companies have contributed code and testing as well. Oracle has recently announced their intention to reach feature-parity between their own Oracle-branded Java releases and the OpenJDK product; this even included the donation of some of their previously-commercial tools such as Flight Recorder to OpenJDK.
The upshot is that you should see very similar behavior and features across the various sources of Java for macOS.
JVM bundled within desktop apps
If you make desktop apps to run locally on a Mac or other computer, you may continue to do so, and keep on using Swing and/or JavaFX as always. But the delivery of your app will change.
Java Applet and Java Web Start technologies are being phased out. Oracle will no longer encourage end-users to have a JVM by itself installed. Instead, Oracle advises building your app as a standalone executable with a JVM bundled inside. This has already been commonly done on Macs, especially so if delivering an app through the Apple App Store. That approach is the new normal, to be done across all platforms including macOS, Windows, Linux, etc. The new Java Modularization technology that began with Java 9, including the jlink and jpackage tools, make it easier than ever to bundle a down-sized JVM with your app.
For more info, see the white paper Java Client Roadmap Update of 2018-03.
So, for the purpose of bundling with your app, you will need to consider redistribution/deployment rights when choosing a JVM vendor and product.
Choosing a vendor
Some major vendors of Java to consider for Java 11 and later:
- Azul Systems
Offering two product lines, Zulu based directly on OpenJDK with possibly a few tweaks, and Zing a specially-enhanced version of the Java platform. - Oracle
Offering their own commercial product Oracle JDK and the quite-similar free-of-cost and GPL-licensed jdk.java.net. - AdoptOpenJDK.net
Offering free-of-cost builds of Java based on OpenJDK. Choose between with the usual HotSpot engine (just-in-time compiler & optimizer) or the OpenJ9 engine from Eclipse (previously from IBM).
Here is a diagram chart that may help guide your decision-making. This chart is not necessarily complete or accurate. It is simply meant to help get you oriented. You should research further your options.


SDKMAN!

A subset of the vendors listed above choose to send their release information to the SDKMAN! project for your convenience.
SDKMAN! is an amazingly simple utility to locate, download, install, and uninstall JDKs, JREs, and other software kits such as Apache Maven, Gradle, etc.
If your JDK/JRE of choice is available via SDKMAN!, then I highly recommend that route.
If you want to have the simplest life possible, install homebrew and then install java with brew cask install java.