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 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
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
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 › mac_install.html
How do I install Java for my Mac?
5. The Install Wizard displays the Welcome to Java installation screen. Click Install · 6. The MacJRE Installer dialog appears, prompting the user to enter a password to continue. Enter Password and click Continue to proceed with installation. 7. This step will initiate install process. Once it ...
🌐
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'
🌐
Oracle
java.com › en › download › help › java_mac.html
Installing and using Oracle Java on macOS
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.
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 i
🌐
Baeldung
baeldung.com › home › java › install java on macos
Install Java on macOS | Baeldung
April 14, 2024 - There are two types of dmg installers available: one for ARM chips for the latest Mac machines like M1 and M2, and one for older “x64” Macs with Intel chips. For our example, we’ll install the x64 installer, although the steps are otherwise the same using the ARM installer: Once the download completes, let’s double-click the DMG file to launch the installer: Furthermore, once the introduction tab opens, click Continue: ... Now, once installation is complete, the Summary tab will be open. Click on the Close button: We’ve successfully installed Java on our Mac via the DMG package.
🌐
Oracle
java.com › en
Java | Oracle
Oracle Java is the #1 programming language and development platform. It reduces costs, shortens development timeframes, drives innovation, and improves application services. Java continues to be the development platform of choice for enterprises and developers · For End Users on a Desktop ...
🌐
Snyk
snyk.io › blog › install-java-on-macos
How to install Java on macOS | Snyk
April 17, 2024 - For this tutorial, select the OpenJDK version you prefer (for example, OpenJDK 11) and choose macOS as your operating system. After selection, click on the `Latest release` button to download the JDK.
🌐
Oracle
java.com › en › download › help › download_options.html
How do I install Java ?
Oracle Java can be installed on Mac versions 10.7.3 or later. A 64-bit browser (Safari, for example) is required to run Oracle Java on Mac.
🌐
Charles Schwab
schwab.com › trading › thinkorswim › download
thinkorswim Download | Charles Schwab
You will now have an icon labelled thinkorswim that displays the thinkorswim logo on your desktop. If this is visible, the installation was completed successfully. You may also search your Program Files folder to access thinkorswim. Note: You do not need to install any other software. A Java virtual machine is included with this download.
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.

🌐
Arnav
arnav.au › home › general › how to install java on macos
How to install Java on MacOS – Where Cloud, Security and AI Converge
August 6, 2025 - Locate the downloaded .dmg file for Java for Mac OS installation. in your Downloads folder and double-click it to open. Double-click the package icon to start the installation process.
🌐
Stevenkussmaul
stevenkussmaul.com › 2021 › 08 › 26 › how-to-install-java-jdk-on-macos
how to install java JDK on MacOS – Steven Kussmaul
August 26, 2021 - first thing is a bit of background to understand how it’s “supposed” to work. there are infininte variations to this but i wanted to do a complete manual install from A-to-Z so i understand what all the installers are doing under the hood. this understanding will also help with troubleshooting java installs for others. To some, it may be easier to just download an installer, either a dmg or pkg file. but, if you start running into trouble, it will be more difficult to troubleshoot something you don’t understand. MacOs used to come with a pre-installed version of java, called Apple Java.
🌐
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.
🌐
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.
🌐
Compuscholar
compuscholar.com › docs › textbooks › instructions2 › Java_JDK_Install_Instructions_Mac.pdf pdf
Download and Installation Instructions Java JDK Software ...
Installing the JDK on Mac OS X or greater is extremely simple. Both the JRE and JDK ... Terminal program and type in “java -version” again.
🌐
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.