🌐
CodeJava
codejava.net › java-se › install-oracle-jdk-18-on-macos
Download and Install Oracle JDK 18 on macOS
Guide to download and install Oracle JDK 18 on macOS, step by step. How to setup Oracle JDK 18 on macOS.
🌐
Thejavaguy
thejavaguy.org › posts › 001-how-to-install-jdk-18-on-macos
How to install Java 18 (OpenJDK 18) on MacOS - TheJavaGuy Blog 🚀
March 10, 2022 - In this article I will show you how to install JDK 18 on MacOS and to setup IntelliJ IDEA so you can write Java applications against it. First you have to visit https://jdk.java.net/18/. Near the top you’ll see build number and download links ...
🌐
Bell Software
bell-sw.com › pages › downloads
Java Download | Java 8, Java 11, Java 17, Java 21, Java 25 - OpenJDK Builds for Linux, Windows & macOS
Download Liberica JDK, supported OpenJDK builds. Open source Java 8, 11 and more for Linux, Windows, macOS.
🌐
CodeJava
codejava.net › java-se › install-openjdk-18-on-macos
Download and Install OpenJDK 18 on macOS
How to download binary archive file of OpenJDK 18 for macOS and install OpenJDK 18 on macOS, step by step.
🌐
Oracle
docs.oracle.com › en › java › javase › 18 › install › installation-jdk-macos.html
4 Installation of the JDK on macOS - Java
July 6, 2022 - Previous Next JavaScript must be enabled to correctly display this content ... The JDK supports both Intel-based (x64) and Apple Silicon (AArch64) Mac computers. ... For supported processors and browsers, see Oracle JDK Certified Systems Configurations. Instructions for installing JDK contains a version notation that represents the Feature, Interim, and Update version information. For example, if you are installing JDK 18 Interim 0, Update 0, and Patch 0, then the following string represents the name of the bundle:
🌐
Oracle
oracle.com › java › technologies › downloads
Download the Latest Java LTS Free
Download the Java including the latest version 17 LTS on the Java SE Platform. These downloads can be used for any purpose, at no cost, under the Java SE binary code license.
🌐
Oracle
jdk.java.net › 18
JDK 18 Releases - Java.net
JDK 18 has been superseded. Please visit jdk.java.net for the current version.
Find elsewhere
🌐
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.
Top answer
1 of 13
400

In 2024, even if you can use just brew..

brew install openjdk@17 

Java will be installed here:

/opt/homebrew/opt/openjdk@17/bin/java

for Apple Intel path is /usr/local/... rather than /opt/homebrew/...

For the system Java wrappers to find this JDK, symlink it with:

sudo ln -sfn /opt/homebrew/opt/openjdk\@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

resp. for Intel

sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Now, running /usr/libexec/java_home -V should show the path to JAVA 17, something like:

17.0.9 (x86_64) "Homebrew" - "OpenJDK 17.0.9" /opt/homebrew/Cellar/openjdk@17/17.0.9/libexec/openjdk.jdk/Contents/Home

(This is what you are missing btw, if javac or javac --version does not give you a command-not-found but an The operation couldn’t be completed. Unable to locate a Java Runtime.)

In case you see the wrong version, check if the path to JAVA_HOME is set correctly. If not, you could set it by:

export JAVA_HOME=\$(/usr/libexec/java_home)

...give a try to sdkman, it's far 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.4.1-tem

Java will be installed here:

/Users/YOUR_USERNAME_HERE/.sdkman/candidates/java/17.0.4.1-tem
2 of 13
56

Java doesn't mind if you install multiple versions. This is often required; java is not backwards compatible (it tries to change little, but e.g. the java8 to java9 transition broke a ton of stuff, much of it needless and much of it not reasonably expectable or fixable by libraries and apps, so a bunch of java apps and libraries only run on java8 - just an example).

So, yes, you have installed JDK17. Also, yes, if you just run java without specifying which one you want, you so happen to get java13 here.

To see all installed javas, you can run:

/usr/libexec/java_home -V

to 'override', you can use something like (depends on which shell you're using on your mac):

export JAVA_HOME=`/usr/libexec/java_home -v 17`

(the backticks mean: Run this then take the output of it and treat that as the 'value' of the expression. here, assign it to the JAVA_HOME env var. -v 17 requests a path to java 17. The -V option lists all and is meant for your eyeballs, not for scripts. The -v option is mostly for scripting, and that's how we're using it here).

JAVA_HOME decides which java is used by some things, but the java you get when you just type java is /usr/bin/java, and that executable is actually just a wrapper that picks a java to run from amongst all installed versions. It uses JAVA_HOME to decide which java to actually run. There are wrappers for all the common commands (javac, too). You can always run e.g. which javac to see what that actually runs; you probably see /usr/bin/javac. Everything in /usr/bin is one of these wrapper thingies that looks at JAVA_HOME and then runs the binary it finds there.

🌐
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.
🌐
Oracle
java.com › en › download › manual.jsp
Download Java
» What is Java » Remove older versions » Security » Support » Other help · 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.
🌐
Reddit
reddit.com › r/macos › oracle released native apple silicon java jdk 17
r/MacOS on Reddit: Oracle released native Apple Silicon Java JDK 17
February 1, 2020 -

Just JDK 17 for now but it's a start:
https://www.oracle.com/java/technologies/downloads/#jdk17-mac

Many apps require Java. You might need some tweaking with apps which complain about version 8 or 11 by editing universalJavaApplicationStub in your App content and adding something like:

export JAVA_HOME=$(/usr/libexec/java_home -v11)

Basically you need to trick the app it's using an older version of Java.

🌐
Reddit
reddit.com › r/mac › how do i download 1.8 java virtual machine? i figured i would just download java and that would fix it but i keep getting this message i’m currently on an m1 imac
r/mac on Reddit: How do I download 1.8 Java virtual machine? I figured I would just download Java and that would fix it but I keep getting this message I’m currently on an M1 IMac
May 24, 2021 - Download the java version for your OS from the linked page. Continue this thread ... Yeah I figured it out I had to go an install 1.6 or something to get it to work now everything runs perfectly! ... Hi, how are you? I am currently with the same problem but I didn t understand your message. How did you do It? Continue this thread Continue this thread ... Java Virtual Machine Launcher.
🌐
Oracle
jdk.java.net › archive
Archived OpenJDK GA Releases - Java.net
This page is an archive of previously released builds of the JDK licensed under the GNU General Public License, version 2, with Classpath Exception · WARNING: These older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest ...
🌐
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 ...