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.