To install OpenJDK on Mac running on Intel or M1/M2 ARM Apple Silicon chip, you can make use of the brew install openjdk command, but if you use it without any version of the lasted Java JDK will get installed which is JDK 18 as of September 2022.
Installing Specific Version of OpenJDK using Brew
Installing Java JDK 8 (ONLY WORKS FOR Intel x86_64)% brew install openjdk@8
Note: OpenJDK 8 is only available for x86_64 architecture,
so you will get an error if you are on ARM M1/M2 Chip.
openjdk@8: The x86_64 architecture is required for this software.
Error: openjdk@8: An unsatisfied requirement failed this build.
You will need to go for other vendors like azul.
brew tap homebrew/cask-versions
brew install --cask zulu8
Installing Java JDK 11
% brew install openjdk@11
Installing Java JDK 17
% brew install openjdk@17

-
Have Questions? Post them here!
More Posts related to MacOS,
- How to Open Finder using Mac Terminal
- How to install maven in macOS using Terminal Command
- How to install iTerm2 Mac Terminal Alternative
- Find Mac version using terminal command
- Zsh Shell: Custom alias that you may find useful
- How to Uninstall Brew on Mac
- Go to Specific file path using Mac Finder
- How to open new tabs macOS Terminal
- fix macOS: The digital signature on the update is missing or invalid. Ventura
- ls: .: Operation not permitted - Mac Terminal ZSH Error
- Closest Alternate to Notepad on Mac
- How to Open Trash on Mac
- How to uninstall Microsoft Outlook on Mac
- [fix] macOS Ventura xcrun: error: invalid active developer path missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
- [Vi/Vim] How to move cursor to the start of a line
- macOS 13 Ventura - The New About this Mac Window
- Best Free Gif screen capture app now available for M1 Chip Mac - LICECap
- 30+ Zoom video communications application shortcuts for macOS
- How to create alias in macOS
- How to install Node using Brew on Mac
- How to start/boot macOS in safe mode - Big Sur 11.0, Catalina 10.15, or Mojave 10.14
- Cant find System Preferences... under macOS Ventura Apple Menu?
- Mac turn dark mode on or off using terminal command
- How to Close Safari in Mac using Keyboard shortcut
- How to Upgrade Mac from Monterey to macOS Ventura
More Posts:
- How to use Autocomplete and Autosuggestion in Shell Commands - Bash
- How to hide or cancel Toast message in Android Programming - Android
- How to extract Java Jar/War/Ear files in Linux - Java
- How to Enable Dark Mode Theme in Microsoft Teams - Teams
- How to make a div tag clickable - Html
- [Fix] brew: command not found Mac or Linux Terminal Error - MacOS
- How to Uninstall Brew on Mac - MacOS
- Java 8 Leap year check using Year class from java.time api - Java