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.

Answer from David Anderson on Stack Exchange
๐ŸŒ
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.
Discussions

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
macos - How to install Java 8 on Mac - Stack Overflow
Java8 is not available for public download anymore. 2019-04-24T13:07:04.52Z+00:00 ... See stackoverflow.com/a/55775566/9306378 if you still want to use java8. Note that this uses OpenJDK though. 2019-04-29T09:46:47.47Z+00:00 ... Assumption: Mac machine and you already have installed homebrew. More on stackoverflow.com
๐ŸŒ stackoverflow.com
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
How to install Java on macOS Sonoma? - Apple Community
I forgot to mention that before ... for the second time, I first tried the Uninstall option of the JRE installer. It reported that it found no Java to uninstall. Possibly running Uninstall before Install makes a difference? ... Hi. I have MacBook Pro M2 Pro Sonoma 14.9. I downloaded the ... More on discussions.apple.com
๐ŸŒ discussions.apple.com
๐ŸŒ
Oracle
oracle.com โ€บ java โ€บ technologies โ€บ downloads
Download the Latest Java LTS Free
JDK 11 software is licensed under the Oracle Technology Network License Agreement for Oracle Java SE. JDK 11.0.29 checksums and OL 9 GPG Keys for RPMs ยท Linux ยท macOS ยท Solaris ยท Windows ยท Documentation Download ยท Online Documentation ยท Installation instructions ยท
๐ŸŒ
Apple Support
support.apple.com โ€บ en-us โ€บ 106384
Download Java for OS X 2017-001 - Apple Support
See http://support.apple.com/kb/HT1222 for information about the security content of this update. Keep your software up to date. If you need Java, download the latest version of Java for OS X directly from Oracle https://www.java.com
Top answer
1 of 2
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 2
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
September 23, 2025 - 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.
Find elsewhere
๐ŸŒ
Oracle
oracle.com โ€บ java โ€บ technical details
Java Plug-in Mac Download Page
Starting with JDK 7 update 6 Oracle provides a JRE version for Mac OS X users which includes a Java Plugin. The download is available in our main Java SE download page.
๐ŸŒ
Apple Community
discussions.apple.com โ€บ thread โ€บ 255283838
How to install Java on macOS Sonoma? - Apple Community
I forgot to mention that before I tried running the installer for the second time, I first tried the Uninstall option of the JRE installer. It reported that it found no Java to uninstall. Possibly running Uninstall before Install makes a difference? ... Hi. I have MacBook Pro M2 Pro Sonoma 14.9. I downloaded the jre-8u401-macosx-aarch64.dmg file from the link in the https://www.java.com/it/download/apple.jsp and the installation looks fine.
Top answer
1 of 11
1209

Note: These solutions work for various versions of Java including Java 8 through Java 21 (the LTS version). This includes alternative JDK's from OpenJDK, Oracle, IBM, Azul, Amazon Correto, Graal and more.

You have a few options for how to do the installation as well as manage JDK switching. Installation can be done by Homebrew, SDKMAN, asdf, or a manual install. Switching can be done by SDKMAN, asdf, or manually by setting JAVA_HOME. All of these are described below.


TL;DR - Preferred Methods of Installation

You can install Java using whatever method you prefer including SDKMAN, asdf, Homebrew, or a manual install of the tar.gz file. The advantage of a manual install is that the location of the JDK can be placed in a standardized location for Mac OSX.

However, there are easier options such as SDKMAN and asdf that also will install other important and common tools for the JVM. These two primary options are described here.

Installing and Switching versions with SDKMAN

SDKMAN is a bit different and handles both the install and the switching. SDKMAN also places the installed JDK's into its own directory tree, which is typically ~/.sdkman/candidates/java. SDKMAN allows setting a global default version, and a version specific to the current shell.

  1. Install SDKMAN from https://sdkman.io/install

  2. List the Java versions available to make sure you know the version ID

    sdk list java
    
  3. Install one of those versions, for example, Java 21 LTS:

    sdk install java 21-open 
    

    Or java 19:

    sdk install java 19.0.2-open
    
  4. Make Java 17 the default version:

    sdk default java 17-open
    

    Or switch to 17 for the current terminal session:

    sdk use java 17-open
    

When you list available versions for installation using the list command, you will see a wide variety of distributions of Java:

sdk list java

And install additional versions, such as JDK 11 from Amazon:

sdk install java 11.0.14.10.1-amzn

SDKMAN can work with previously installed existing versions. Just do a local install giving your own version label and the location of the JDK:

sdk install java my-local-13 /Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home

And use it freely:

sdk use java my-local-13

SDKMAN will automatically manage your PATH and JAVA_HOME for you as you change versions. And as a note, it installs Java versions to ~/.sdkman/candidates/java/.

More information is available in the SDKMAN Usage Guide along with other SDK's it can install and manage such as Gradle, Maven, Kotlin, Quarkus, Spring Boot, and many others.


Installing and Switching versions with "asdf"

asdf is a version manager that supports installing and managing most languages, frameworks, and developer/devops tools. It has language specific plugins including one for Java.

  1. First, install asdf via https://asdf-vm.com/guide/getting-started.html (read there to setup your shell correctly), or more simply:

    brew reinstall asdf
    

    and read the doc for setting up your shell correctly, but if you are using asdf from Homebrew with ZSH you can execute this command to finish setup:

    echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
    
  2. Then install the Java plugin via https://github.com/halcyon/asdf-java

    asdf plugin add java
    

    and read the doc for setting up your shell correctly before continuing. Basically it says to add the following to your ~/.zshrc file (assuming you are not using another shell):

    . ~/.asdf/plugins/java/set-java-home.zsh
    
  3. Now list Java versions:

    asdf list-all java
    
  4. Install your favorite flavor and version:

    asdf install java openjdk-21
    

    or install the latest:

    asdf install java latest
    

Other important commands are...

  • List your installed versions:

    asdf list java
    
  • Set a global Java version:

    asdf global java openjdk-21
    
  • Set a local Java version for a directory:

    asdf local java openjdk-19
    

It's that easy! asdf will automatically manage your PATH and JAVA_HOME for you as you change versions. As a note, asdf installs Java versions to ~/.asdf/installs/java.

There are other languages and plugins for asdf here from the repository page: https://github.com/asdf-vm/asdf-plugins


Other Methods of Installation

Install with Homebrew

The version of Java available in Homebrew Cask previous to October 3, 2018 was indeed the Oracle JVM. Now, however, it has now been updated to OpenJDK. Be sure to update Homebrew and then you will see the lastest version available for install.

  1. install Homebrew if you haven't already. Make sure it is updated:

     brew update
    
  2. Add the casks tap:

     brew tap homebrew/cask-versions
    

    These casks change their Java versions often, and there might be other taps out there with additional Java versions.

  3. Look for installable versions:

     brew search java  
    

    or for Eclipse Temurin versions:

     brew search temurin     
    
  4. Check the details on the version that will be installed:

     brew info java
    

    or for the Temurin version:

     brew info temurin
    
  5. Install a specific version of the JDK such as java11, temurin8, temurin11, temurin17, or just java or temurin for the most current of that distribution. For example:

     brew install java
    
     brew install --cask temurin
    

And these will be installed into /Library/Java/JavaVirtualMachines/ which is the traditional location expected on Mac OSX. There might be additional steps to make the JDK active reported at the end of the install process.

Install manually from OpenJDK download page:

If you need any and every version of Java, this is a good place to look.

  1. Download OpenJDK for Mac OSX from http://jdk.java.net/ (for example Java 17 and Java 21)

  2. Unarchive the OpenJDK tar, and place the resulting folder (i.e. jdk-19.jdk) into your /Library/Java/JavaVirtualMachines/ folder since this is the standard and expected location of JDK installs. You can also install anywhere you want in reality.

  3. Set JAVA_HOME environment variable to point at direction where you unarchived the JDK.

For further information see the answer specific to manual installation. Also see the section below "Switching versions manually" for more information on how to manage multiple manual installations.

Other installation options:

Some other flavours of OpenJDK are:

Azul Systems Java Zulu certified builds of OpenJDK can be installed by following the instructions on their site.

Zulu is a certified build of OpenJDK that is fully compliant with the Java SE standard. Zulu is 100% open source and freely downloadable. Now Java developers, system administrators, and end-users can enjoy the full benefits of open source Java with deployment flexibility and control over upgrade timing.

Amazon Correto OpenJDK builds have an easy to use an installation package for Java 8, 11, 17, and Java 21. It installs to the standard /Library/Java/JavaVirtualMachines/ directory on Mac OSX.

Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK). Corretto comes with long-term support that will include performance enhancements and security fixes. Amazon runs Corretto internally on thousands of production services and Corretto is certified as compatible with the Java SE standard. With Corretto, you can develop and run Java applications on popular operating systems, including Linux, Windows, and macOS.

Microsoft Java JDK - certified builds of OpenJDK from Microsoft.


Where is my JDK?!?!

To find locations of previously installed Java JDK's installed at the default system locations, use:

/usr/libexec/java_home -V

Matching Java Virtual Machines (4):
19 (x86_64) "Homebrew" - "OpenJDK 19" /usr/local/Cellar/openjdk/19/libexec/openjdk.jdk/Contents/Home
18.0.1.1 (x86_64) "Homebrew" - "OpenJDK 18.0.1.1" /usr/local/Cellar/openjdk/18.0.1.1/libexec/openjdk.jdk/Contents/Home
17 (x86_64) "Homebrew" - "OpenJDK 17" /usr/local/Cellar/openjdk/17/libexec/openjdk.jdk/Contents/Home
11, x86_64: "Java SE 11" /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
1.8.301.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home /usr/local/Cellar/openjdk/17/libexec/openjdk.jdk/Contents/Home

You can also report just the location of a specific Java version using -v. For example for Java 17:

/usr/libexec/java_home -v 17

/usr/local/Cellar/openjdk/17/libexec/openjdk.jdk/Contents/Home

Knowing the location of the installed JDK's is also useful when using tools like JEnv, or adding a local install manually to SDKMAN -- and you need to know where to find them.

If you need to find JDK's installed by other tools, check these locations:

  • SDKMAN installs to ~/.sdkman/candidates/java/
  • asdf install to ~/.asdf/installs/java

Version Switching

If you are using SDKMAN or asdf you are already covered and can stop reading! Otherwise, here are some options to switch existing VM installations.

Switching versions manually

The Java executable is a wrapper that will use whatever JDK is configured in JAVA_HOME, so you can change that to also change which JDK is in use.

For example, if you installed or untar'd JDK 16 to /Library/Java/JavaVirtualMachines/jdk-16.jdk if it is the highest version number it should already be the default, if not you could simply set:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home

And now whatever Java executable is in the path will see this and use the correct JDK.

A simple way to change JDKs is to create a function in your ~/.bashrc or ~/.zshrc file:

jdk() {
    version=$1
    export JAVA_HOME=$(/usr/libexec/java_home -v"$version");
    java -version
}

And then change JDKs simply by:

jdk 1.8
jdk 9
jdk 11
jdk 13

Edits:

  • removed Jabba and JENV as both appear to have stagnated, issue count is climbing dramatically, and issues/PR's are not being addressed by the maintainers.
2 of 11
41

This is how I did it.

Step 1: Install Java 11

You can download Java 11 dmg for mac from here: https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html

Step 2: After installation of Java 11. Confirm installation of all versions. Type the following command in your terminal.

/usr/libexec/java_home -V

Step 3: Edit .bash_profile

sudo nano ~/.bash_profile

Step 4: Add 11.0.1 as default. (Add below line to bash_profile file).

export JAVA_HOME=$(/usr/libexec/java_home -v 11.0.1)

to switch to any version

export JAVA_HOME=$(/usr/libexec/java_home -v X.X.X)

Now Press CTRL+X to exit the bash. Press 'Y' to save changes.

Step 5: Reload bash_profile

source ~/.bash_profile

Step 6: Confirm current version of Java

java -version
๐ŸŒ
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 - Go to the Oracle official site to download Java 23 by clicking on the download option as highlighted in the below media over where you need to download '.dmg' one and carry on with the download procedure.
๐ŸŒ
Oracle
oracle.com โ€บ java โ€บ technologies โ€บ javase โ€บ jdk17-archive-downloads.html
Java Archive Downloads - Java SE 17.0.12 and earlier
Go to the Oracle Java Archive page. This page includes archive downloads for JDK 17 updates 17.0.12 and earlier.
๐ŸŒ
JetBrains
jetbrains.com โ€บ idea โ€บ download
Download IntelliJ IDEA
June 1, 2021 - Download the latest version of IntelliJ IDEA, the leading IDE for professional development in Java and Kotlin. Available for Windows, macOS, and Linux.
๐ŸŒ
Andrew Hoog
andrewhoog.com โ€บ posts โ€บ 3-ways-to-install-java-on-macos-2023
3 ways to install Java on macOS [2023] | Andrew Hoog
January 12, 2023 - So generally folks will go to java.com ... Download Java button! :-) Instead, click on the OpenJDK Early Access Builds which will then let you select which JDK you want to install.
๐ŸŒ
Macupdate
apple-java.macupdate.com โ€บ system utilities โ€บ apple java
Download Apple Java for Mac | MacUpdate
Download the latest version of Apple Java for Mac for free. Read 64 user reviews and compare with similar apps on MacUpdate.
๐ŸŒ
OpenJDK
openjdk.org
OpenJDK
Learn about the key active Projects in the Community including Amber (high-productivity language features), Loom (lightweight concurrency), Panama (foreign functions and foreign data), Valhalla (primitive types and specialized generics), and, of course, the next version of Java and the JDK ...
๐ŸŒ
Softonic
apple-java-for-mac.en.softonic.com โ€บ home โ€บ utilities & tools โ€บ java for os x โ€บ download
Download Java for OS X for Mac - Free - latest version
Download Java for OS X for Mac now from Softonic: 100% safe and virus free. More than 22 downloads this month. Download Java for OS X latest version