In 2022, you can use just brew

brew install openjdk

and maybe you need to update PATH env:

export PATH="/usr/local/opt/openjdk/bin:$PATH"

…and for the future give a try to sdkman, is better than brew

curl -s "https://get.sdkman.io" | bash

then open a new shell and try list to see what you could install ;-)

sdk list java 

At time of writing you could use:

sdk install java 17.0.1-tem
Answer from freedev on Stack Overflow
🌐
Oracle
java.com › en › download › help › mac_install.html
How do I install Java for my Mac?
To confirm installed Java version, refer to instructions page here: https://www.java.com/en/download/help/version_manual.html · Note: Below instructions are specific to macOS Big Sur (11.x) 1. Download the jre-8u311-macosx-x64.dmg file. Review and agree to the terms of the license agreement before downloading the file. ... 4. Double-click on the .app icon to launch install Wizard.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-install-java-on-mac
How to Install Java on Mac in 2026
February 20, 2026 - Java is the most widely used programming language for enterprise software, Android development, and university computer science courses. Apple doesn't include Java with macOS, so you need to install i
Discussions

macos - How to install Java on a Mac - Stack Overflow
I have been doing some research on how to install Java jre and jdk on correct PATH. I lack the comprehension when coming to understand what others would instruct on to change path in the terminal. ... More on stackoverflow.com
🌐 stackoverflow.com
macos - How to brew install java? - Stack Overflow
On my Mac running Big Sur, I had to do: sudo ln -sfn /usr/local/Cellar/openjdk/18.0.2.1/libexec/openjdk.jdk \ /Library/Java/JavaVirtualMachines/openjdk.jdk 2022-09-22T00:01:26.84Z+00:00 ... As an add-on to the accepted answer: to install a certain version of Java, e.g. More on stackoverflow.com
🌐 stackoverflow.com
How do I install java for Mac
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
16
5
May 16, 2025
Java Dev switching to Mac for the first time
am java dev, macs + intellij(use to install java) + homebrew(install other stuff) = easy peasy More on reddit.com
🌐 r/mac
28
8
March 20, 2022
🌐
Oracle
java.com › en › download › help › java_mac.html
Installing and using Oracle Java on macOS
See How to update Java on Mac. How do I enable Java on my Mac? When you install Oracle Java on your Mac (Lion and above), Java will be enabled by default. If you are running a Java application in the browser, you will need to also check that Java is enabled in your browser.
🌐
Uakron
cs.uakron.edu › ~xiao › isp › JavaOnMacOS.html
Installing Java on MacOS
If you get a message that says: 'No Java runtime present requesting install', then you do not have Java installed on your system. Go to this link to download Java JDK. You can download the latest version if you wish · Download the .dmg file that says 'macOS Installer'
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-java-on-macos
How to Install Java on MacOS: A Step-by-Step JDK Installation - GeeksforGeeks
July 23, 2025 - Open the DMG file -> double click the JDK package to downloaded in the previous step to start installing Oracle JDK 23 on your Mac. It will install the DMG disk and presents the installer as shown in Figure.
🌐
MacPaw
macpaw.com › how to › optimization › apps
How to install Java on your Mac
August 19, 2025 - Click the link to download the DMG for your Mac. When the DMG file has downloaded, double-click it to mount it. Inside the mounted disk image, double-click the JDK pkg file. Click Continue on the Welcome screen.
🌐
Snyk
snyk.io › blog › install-java-on-macos
How to install Java on macOS | Snyk
April 17, 2024 - If Java is already installed on your system, this command will display the current version. If not, Terminal will prompt you to install a JDK. Homebrew is a free and open source software package management system that simplifies the installation of software on macOS.
Find elsewhere
🌐
Medium
tejaksha-k.medium.com › a-step-by-step-guide-to-installing-java-on-macos-5188bfdf99d7
A Step-by-Step Guide to Installing Java on macOS | by Tejaksha K | Medium
July 29, 2024 - Java is a versatile and widely-used programming language that powers a vast array of applications, from web and mobile apps to enterprise systems. If you’re a macOS user looking to install Java on your machine, this step-by-step guide will walk you through the process and get you ready to ...
🌐
XDA Developers
xda-developers.com › home › macos guides › how to install java on macos
How to install Java on macOS
November 13, 2023 - Note that there are different versions of Java for systems based on Intel or Apple Silicon. Be sure to choose the correct version of Java for the installation to be successful. Open the Apple menu in the menu bar. Click the About This Mac tab.
🌐
Adam the Automator
adamtheautomator.com › install-java-on-mac
How to Install Java on Mac
November 30, 2022 - Learn how to install Java on Mac securely and safely with either OpenJDK or Oracle Java to run all of your Java applications!
🌐
OS X Daily
osxdaily.com › home › how to install java on mac with m3, m2, m1 apple silicon chip
How to Install Java on Mac with M3, M2, M1 Apple Silicon Chip - OS X Daily
June 3, 2024 - For an Apple Silicon (M1, M2, M3, etc) Mac, choose the “ARM64 DMG Installer” download (Intel Mac users can use the X64 download, but we’re focusing on Apple Silicon here) After the DMG file has downloaded, mount the DMG file as usual and then click on the pkg installer to begin installation of Java on the Mac
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to install java on mac
How to Install Java on Mac | phoenixNAP KB
May 8, 2025 - Install Java on Mac by following this step-by-step tutorial. The article provides simple instructions for installing the JDK and the JRE.
Top answer
1 of 3
1

I tested this answer using a clean install of High Sierra 10.13.6. All updates from Apple were installed.

The downloads of the JDKs can be found at Java Downloads. I could not correctly view this site using Safari under High Sierra. Instead, I installed and used Firefox ESR (Extend Support Release). This link for Firefox download can be successfull viewed from Safari. The file I downloaded and installed was Firefox 115.16.1esr.dmg.

I tried JDK 23 by downloading and installing jdk-23_macos-x64_bin.dmg. This was not recognized by Java. Next, I tried JDK 21 by downloading and installing jdk-21_macos-x64_bin.dmg. This was recognized by Java.

Instructions for uninstalling a JDK can be found here. Personally, I just used the Finder to move the /Library/Java/JavaVirtualMachines/jdk-23.jdk folder to the Trash.

I tested by using the simple code given below. The code was stored in the file named Simple.java.

class Simple{  
    public static void main(String args[]){  
     System.out.println("Hello Java");  
    }  
}

Example of testing is given below.

dmas-Mac:Desktop dma$ javac Simple.java 
dmas-Mac:Desktop dma$ java Simple
Hello Java

BTW, I tested JDK 23 using macOS Monterey and did not encounter the problems that occurred with High Sierra.

2 of 3
0

I've successfully installed Java 21 from Microsoft on High Sierra.

$ java --version
openjdk 21.0.8 2025-07-15 LTS
OpenJDK Runtime Environment Microsoft-11933195 (build 21.0.8+9-LTS)
OpenJDK 64-Bit Server VM Microsoft-11933195 (build 21.0.8+9-LTS, mixed mode, sharing)

Java 25 has the some issue as mentioned above. It looks like the jdks have been build with a dependency to "chkstk_darwin" which ist not available in High Sierra.

🌐
Mac Install Guide
mac.install.guide › java › install
Install Java on Mac · Mac Install Guide · 2026
The easiest way to get Java working is the free app,Set Up Your Mac for Java. It installs Java, sets JAVA_HOME, and verifies it works. Recommended! ... How to install Java on Mac. Get a recommended JDK, use the installer, and verify Java on macOS. Which JDK to use.
🌐
Baeldung
baeldung.com › home › java › install java on macos
Install Java on macOS | Baeldung
April 14, 2024 - The first way is installing Java with a DMG package (a disk image file). A DMG package acts as a virtual optical disc containing compressed software installation files and other data like bootable images.
🌐
Opensource.com
opensource.com › article › 20 › 7 › install-java-mac
How to install Java on a Mac | Opensource.com
Java must include these benefits to compete in the era of cloud-native, microservices, and serverless applications. The Homebrew package manager makes it easy to install and update applications and utilities on a Mac.
🌐
Reddit
reddit.com › r/javahelp › how do i install java for mac
r/javahelp on Reddit: How do I install java for Mac
May 16, 2025 -

I install java x64 DMG installer for Mac. I installed the on my Mac and when I go check it in terminal it tells me that no such file or directory is found my Mac? I want to use Java to create Minecraft mods.

🌐
Snyk
snyk.io › blog › installing-and-managing-java-on-macos
Installing and managing Java on macOS | Snyk
October 12, 2023 - This page also includes a Java Archive section for finding specific older versions. Select the Java version that meets your requirements, download the macOS installer as a DMG file, and double-click to run it. Follow the prompts to install Java ...