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
-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to MacOS,
- How to Display Analog Clock on Mac Menu Bar
- Shutdown Mac Terminal Command
- How to know the Serial Number of MacBook on macOS Ventura 13.0
- macOS: Remove Desktop or Documents Folder from iCloud Drive Syncing
- [fix] How to Show file extensions on all files on Mac
- How to install Zoom Add-in to Outlook (Mac)
- How to turn off Stage Manager - macOS Ventura
- Fix - Xode - Internal logic error: Connection was invalidated
- How to do calculations in Mac Terminal
- How to delete a Page in Microsoft Word File on Mac (macOS)
- How to Refresh Mac Desktop
- How to install Java on macOS [Big Sur]
- How to Disable Mac Terminal Bell Sound
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to Uninstall Brew on Mac
- Find your macOS version
- Change TextEdit File Encoding
- AppleScript Example with TextEdit
- How to install homebrew (brew) on M1 Mac
- How to Find File and Directory Size in Mac Terminal
- How to open new tab in Sublime Text Editor [macOS]
- How to list all users in Mac Terminal
- Turn off Auto-Capitalization on macOS Ventura 13
- How to check Command Line Tools Version [Updated for Ventura]
- Change Current User Password using Mac Terminal Command
More Posts:
- Fix: python3: Library/Developer/CommandLineTools/usr/bin/python3: No module named notebook (jupyter) - Python
- Remove Html head and body tags from ckeditor source - Html
- PowerShell Get Currently Logged In User on Mac - Powershell
- Enable Native Dark Mode in Notepad++ - NotepadPlusPlus
- Mac: How to show count of files and folders in Finder - MacOS
- Upload Pdf file using PHP Script - PHP
- Parsing CSV file using Java code example (Comma Separated File) - Java
- Python: Fix ModuleNotFoundError - No module named pandas - Python