Just found out that the Oracle installer did follow the tradition of keeping the JDK in its own directory, in this case, it was /Library/Java/JavaVirtualMachines/.

Knowing this, the rest was easy, and I can now manage JDK 15 with SDKMAN, along with JDK 17 (and other future versions) which was installed with sdk install java 17.0.12-oracle. Let bash do the talking:

$ mkdir ~/.sdkman/candidates/java/15.0.2-oracle

$ cp -r /Library/Java/JavaVirtualMachines/jdk-15.0.2.jdk/Contents/Home/ \
     ~/.sdkman/candidates/java/15.0.2-oracle/

$ ls ~/.sdkman/candidates/java/15.0.2-oracle/
bin     conf    include jmods   legal   lib     man     release

$ sdk use java 15.0.2-oracle
Using java version 15.0.2-oracle in this shell.

$ java --version
java 15.0.2 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

$ sdk use java 17.0.12-oracle 

Using java version 17.0.12-oracle in this shell.

$ java --version
java 17.0.12 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)

Of course, I don't need to tell you that if you have a choice, use a more recent JDK!

Answer from Nagev on Stack Overflow
🌐
Oracle
docs.oracle.com › en › java › javase › 15 › install › installation-jdk-macos.html
Installation of the JDK on macOS
Download the JDK .dmg file, jdk-15.interim.update.patch_osx-x64_bin.dmg from Java SE Downloads page. Click Accept License Agreement. From either the browser Downloads window or from the file browser, double-click the .dmg file to start it. A Finder window appears that contains an icon of an ...
🌐
Studyopedia
studyopedia.com › home › how to download and install java 15 on macos
How to download and install Java 15 on macOS - Studyopedia
December 23, 2025 - To download Java JDK 15, go to Oracle’s official website and click “Download Java“: ... Now, the Downloads page will be visible. Go to the bottom of the page, and click on the macOS installer ...
Discussions

java - Install JDK15 for MacBook with Apple silicon and manage multiple versions - Stack Overflow
I need JDK 15 (which seems to be a rare breed). I want to manage multiple versions, ideally with SDKMAN, since I already used it to install JDK17. In the past, I've managed multiple Java versions with SDKMAN!, from external sources, including brew (Homebrew), if they were not available with ... More on stackoverflow.com
🌐 stackoverflow.com
macos - How do I install Java on Mac OSX allowing version switching? - Stack Overflow
2021-07-15T12:55:22.093Z+00:00 ... Save this answer. ... Show activity on this post. Manually switching system-default version without 3rd party tools: As detailed in this older answer, on macOS /usr/bin/java is a wrapper tool that will use Java version pointed by JAVA_HOME or if that variable is not set will look for Java installations ... More on stackoverflow.com
🌐 stackoverflow.com
Trying to run 1.12.2 mods on a mac and it wants me to install a JDK to use Forge. Which version of Java should I be using?

Do you need an oracle account to access https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html ? It doesn't seem to ask for one for me.

More on reddit.com
🌐 r/feedthebeast
8
0
January 9, 2019
Install Optifine on macOS without Java

There's already a private copy of Java installed alongside Minecraft. I don't know where it lives on a Mac (if it helps: the Windows equivalent is in C:\Program Files (x86)\Minecraft\runtime\jre-x64\1.8.0_25\bin\javaw.exe).

You could use the Minecraft Launcher to find it: edit a profile using Launch Options and enable the Java Executable option to see the path.

https://minecraft.gamepedia.com/Minecraft_launcher#Profiles

More on reddit.com
🌐 r/Minecraft
19
3
December 29, 2017
🌐
Tutorials24x7
java.tutorials24x7.com › blog › how-to-install-openjdk-15-on-mac
How To Install OpenJDK 15 On Mac | Tutorials24x7
October 22, 2020 - It might show the message - "No ... select the available versions as shown in Fig 3. ... Click the Download Link as highlighted in Fig 3 to download OpenJDK 15 for macOS....
🌐
Tutorials24x7
java.tutorials24x7.com › blog › how-to-install-java-15-on-mac
How To Install Java 15 On Mac | Tutorials24x7
October 22, 2020 - Double click the DMG file downloaded in the previous step to start installing Oracle JDK 15 on Mac. It will mount the DMG disk and shows the installer as shown in Fig 5 and Fig 6. Make sure that you have gone through the updated License Agreement ...
🌐
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.
🌐
Knasmueller
knasmueller.net › home › how to install java openjdk 15 on macos catalina
How to Install Java OpenJDK 15 on macOS Catalina - Bernhard Knasmüller on Software Development
April 10, 2021 - Download the .tar.gz version of OpenJDK 15 from jdk.java.net/15/ and move the file to /Library/Java/JavaVirtualMachines/ on your mac.
Find elsewhere
🌐
Mkyong
mkyong.com › home › java › how to install java jdk on macos
How to install Java JDK on macOS - Mkyong.com
January 19, 2021 - This article shows how to install Java JDK on macOS, Homebrew package manager, manual installation, and switch between different JDK versions. ... P.S At the time of writing, the latest JDK GA is JDK 15, and the early access build is JDK 16.
Top answer
1 of 11
1214

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.

Copy/usr/libexec/java_home -V

Step 3: Edit .bash_profile

Copysudo nano ~/.bash_profile

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

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

to switch to any version

Copyexport 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

Copysource ~/.bash_profile

Step 6: Confirm current version of Java

Copyjava -version
🌐
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.
🌐
GitHub
gist.github.com › gwpantazes › 50810d5635fc2e053ad117b39b597a14
How to install different JDK versions on MacOS with Homebrew · GitHub
Java.net | | 16.ea.24 | open | | 16.ea.24-open | | 16.ea.7.lm | open | | 16.ea.7.lm-open | | 16.ea.2.pma | open | | 16.ea.2.pma-open | | 15.0.1 | open | | 15.0.1-open | | 14.0.2 | open | | 14.0.2-open | | 14.0.1 | open | local only | 14.0.1-open | | 13.0.2 | open | | 13.0.2-open | | 12.0.2 | open | | 12.0.2-open | >>> | 11.0.2 | open | installed ...
🌐
Knasmueller
knasmueller.net › home › how to install java openjdk 15 on macos big sur
How to Install Java OpenJDK 15 on macOS Big Sur - Bernhard Knasmüller on Software Development
April 10, 2021 - Download the .tar.gz version of OpenJDK 15 from jdk.java.net/15/ and move the file to /Library/Java/JavaVirtualMachines/ on your mac.
🌐
Uakron
cs.uakron.edu › ~xiao › isp › JavaOnMacOS.html
Installing Java on MacOS
Skip to 'Creating hello world program in java' to create a simple program · 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 ...
🌐
Oracle
oracle.com › java › technologies › javase › jdk15-archive-downloads.html
Java Archive Downloads - Java SE 15
Go to the Oracle Java Archive page · The JDK is a development environment for building applications using the Java programming language
🌐
Oracle
java.com › en › download › help › catalina_java.html
How do I install Oracle Java on macOS Catalina (10.15)?
Changes introduced with macOS 10.15 (Catalina) cause certain Java applications to behave incorrectly. Therefore, we cannot certify any JDK version on macOS 10.15 yet. However, as of now, you can install and run non-notarized software on macOS 10.15 systems by modifying your security preferences.
🌐
Oracle
java.com › en › download › apple.jsp
Java for Mac
下载适用于 macOS ARM64 的 Java 下载 Java 表示贵方确认已阅读并接受适用于 Oracle Java SE 的 Oracle 技术网许可协议的条款。 Oracle Java 许可重要信息.
🌐
Opensource.com
opensource.com › article › 20 › 7 › install-java-mac
How to install Java on a Mac | Opensource.com
(If you are running Linux, please see Seth Kenlon's article How to install Java on Linux.) Homebrew is the de-facto standard package manager for macOS.
🌐
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 - Here we will be discussing the ... following steps: 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 ...
🌐
TecAdmin
tecadmin.net › install-java-macos
How to Install JAVA on macOS – TecAdmin
April 26, 2025 - MacOS install Java. How to Install JAVA on macOS. The installation insruction of Java on macOS using brew. Installing java on macOS