Turns out java has been moved into brew core recently, so the correct command as of August 2022 is:

brew install java

Then check your installation by running

java -version

If the result does not looks like this:

openjdk 18.0.2 2022-07-19
OpenJDK Runtime Environment Homebrew (build 18.0.2+0)
OpenJDK 64-Bit Server VM Homebrew (build 18.0.2+0, mixed mode, sharing)

but like this:

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Then you also need to create a symlink for the system Java wrappers to find this JDK:

sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk \
     /Library/Java/JavaVirtualMachines/openjdk.jdk
Answer from Tim Fulmer on Stack Overflow
🌐
Oracle
java.com › en › download › manual.jsp
Download Java
This download is for end users who need Java for running applications on desktops or laptops. Java 8 integrates with your operating system to run separately installed Java applications.
🌐
Oracle
oracle.com › java › technologies › downloads
Download the Latest Java LTS Free
Subsequent JDK 25 updates will be licensed under the Java SE OTN License (OTN) and production use beyond the limited free grants of the OTN license will require a fee. Linux · macOS · Windows · Documentation Download · Online Documentation · Installation Instructions ·
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
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
How to install Java on M1 Max Macbook?
If there’s no specific reason you need Oracle’s JDK you can use OpenJDK which has native support for M1. More on reddit.com
🌐 r/MacOS
2
1
January 19, 2022
Which Java JDK do I download for Mac?
It seems you may have included a screenshot of code in your post " Which Java JDK do I download for Mac? ". If so, note that posting screenshots of code is against r/learnprogramming 's Posting Guidelines (section Formatting Code): please edit your post to use one of the approved ways of formatting code . (Do NOT repost your question! Just edit it.) If your image is not actually a screenshot of code, feel free to ignore this message. Automoderator cannot distinguish between code screenshots and other images. Please, do not contact the moderators about this message. Your post is still visible to everyone. 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/learnprogramming
3
0
September 14, 2021
🌐
Oracle
java.com › en › download › help › mac_install.html
How do I install Java for my Mac?
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. You might be prompted with message indicating app being downloaded from the Internet. Are you sure you want to open it? (See below screenshot as reference). Click Open to continue. 5. The Install Wizard displays the Welcome to Java installation screen.
🌐
Oracle
java.com › en › download › help › java_mac.html
Installing and using Oracle Java on macOS
Information about Oracle Java for Mac - Install, remove, revert Apple Java 6, configure, system requirements
🌐
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'
Find elsewhere
🌐
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 it yourself.
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.

🌐
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.

🌐
Azul Systems
azul.com › home › azul downloads
Java 8, 11, 17, 21, 25 Download for Linux, Windows and macOS
January 30, 2023 - Click here to download the Azul Zulu Builds of OpenJDK for Java 8, 11, 17, 21, 25 for Linux, Windows and macOS. Also download Azul Platform Prime.
🌐
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.
🌐
ImageJ
imagej.net › ij › download.html
Download
Download ImageJ bundled with Java 8 (may need to work around Path Randomization). Instructions. With M1 (ARM) Macs, download ImageJ bundled with Zulu OpenJDK 13.0.6.
🌐
Mac Install Guide
mac.install.guide › java › install
Install Java on Mac · Mac Install Guide · 2026
You download the installer directly from the vendor website, double-click to install, follow the wizard, and enter your admin password. This method works well for users who prefer a graphical installer or do not use Homebrew.
🌐
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.
🌐
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 ...
🌐
Quora
quora.com › Is-Java-installed-on-my-Mac
Is Java installed on my Mac? - Quora
Answer: Nobody can answer your question without having access to you Mac. The Mac no longer ships with Java pre-installed, But it can be installed by downloading and installing it from a number of sources. I recommend axil’s Zulu JDK, but you can also use others.
🌐
Oracle
jdk.java.net
JDK Builds from Oracle
Looking to learn more about Java? Visit dev.java for the latest Java developer news and resources · Looking for Oracle JDK builds and information about Oracle’s enterprise Java products and services? Visit the Oracle JDK Download page
🌐
Apple Support
support.apple.com › en-us › 106384
Download Java for OS X 2017-001 - Apple Support
Java for macOS 2017-001 installs the legacy Java 6 runtime for macOS 10.13 High Sierra, macOS 10.12 Sierra, macOS 10.11 El Capitan, macOS 10.10 Yosemite, macOS 10.9 Mavericks, macOS 10.8 Mountain Lion, and macOS 10.7 Lion.
🌐
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 - This tutorial provided installation instructions for installing the Java Development Kit and Java Runtime Environment on macOS.