Java 17 is the LDS - Long Term Support version released to the public in September 2021. If you want to install Java 17 JDK natively on have multiple options,
We will the installing the Oracle OpenJDK 17 using brew, it will by default pick the ARM 64 bit version.
How to install Brew on M1/M2 Mac
Brew Command:brew install openjdk@17
==> Downloading https://ghcr.io/v2/homebrew/core/openjdk/17/manifests/17.0.4.1
...
...
If you need to have openjdk@17 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk@17 you may need to set:
export CPPFLAGS="-I/opt/homebrew/opt/openjdk@17/include"

If you want to use JDK 17 as the default, you will need to add it to the PATH in .zshrc file (both java and javac)
% echo 'export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
% export CPPFLAGS="-I/opt/homebrew/opt/openjdk@17/include"
After setting the path, you can check if it took effect by reloading the zsh shell (just type zsh on prompt) and running the version commands,
% java -version
openjdk version "17.0.4.1" 2022-08-12
OpenJDK Runtime Environment Homebrew (build 17.0.4.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.4.1+0, mixed mode, sharing)
% javac -version
javac 17.0.4.1
Have Questions? Post them here!
- How to find path of file on Mac Terminal
- How to disable Siri on Mac Monterey
- [fix] macOS Ventura xcrun: error: invalid active developer path missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
- Select Line Number TextEdit on Mac
- Go to Specific file path using Mac Finder
- How to find Java HOME in Mac Terminal
- bash: command not found error [macOS Terminal Linux, Unix or Windows]
- Must Know Homebrew Commands for Mac/Linux Users
- How to Insert an Inverted Question Mark on Mac ¿
- Hide Keyboard Text Input Icon on macOS Ventura Menu Bar
- How to make macOS Terminal window Transparent (or Opaque)
- How to check of Updates on Microsoft Edge Browser on Mac (macOS)
- Limit scrollback rows in macOS Terminal
- How to identify installed Java (JDK) Version on macOS
- Keyboard Shortcut to delete a file on a Mac [Macbook]
- Open Docker from Terminal Command on Mac
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to take a screenshot on a Mac - updated for Ventura 13 [updated 2023]
- ls: .: Operation not permitted - Mac Terminal ZSH Error
- How to remove username from Mac Menu Bar?
- macOS Ventura XCode Command Line Tools Installation
- Where is .zshrc file located in macOS
- How to Show Path of Files or App in Mac Spotlight Search
- How to enable root user on Mac Terminal
- Install Java 17 (LTS) JDK on ARM based M1/M2 Mac Natively
- [fix] Java NullPointerException ComparableTimSort countRunAndMakeAscending when sorting a List - Java
- Microsoft Stream - This may not be for you, It looks like you don't have permission to watch this video - Microsoft
- Add Custom header and footer to Windows Notepad file - NotepadPlusPlus
- Android Toast position top - Android
- How to Setup AWS Credentials using Visual Studio Code - AWS
- How to check RAM details on Mac? - MacOS
- Java - PatternSyntaxException - Java
- Indent XML Formatting In Notepad++ - NotepadPlusPlus