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

Copybrew install openjdk@17 

Java will be installed here:

Copy/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:

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

resp. for Intel

Copysudo 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:

Copy17.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:

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

...give a try to sdkman, it's far better than brew

Copycurl -s "https://get.sdkman.io" | bash

then open a new shell and try list to see what you could install ;-)

Copysdk list java 

At time of writing you could use:

Copysdk install java 17.0.4.1-tem

Java will be installed here:

Copy/Users/YOUR_USERNAME_HERE/.sdkman/candidates/java/17.0.4.1-tem
Answer from freedev on Stack Overflow
🌐
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.
Top answer
1 of 13
407

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

Copybrew install openjdk@17 

Java will be installed here:

Copy/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:

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

resp. for Intel

Copysudo 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:

Copy17.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:

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

...give a try to sdkman, it's far better than brew

Copycurl -s "https://get.sdkman.io" | bash

then open a new shell and try list to see what you could install ;-)

Copysdk list java 

At time of writing you could use:

Copysdk install java 17.0.4.1-tem

Java will be installed here:

Copy/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:

Copy/usr/libexec/java_home -V

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

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

Discussions

Oracle released native Apple Silicon Java JDK 17

Not sure when Open JDK released it, but it's there too https://jdk.java.net/17/

[ edit ] It was released on August 7th this year.https://openjdk.java.net/jeps/391 [/ edit ]

More on reddit.com
🌐 r/MacOS
13
50
September 22, 2021
HOW DO YOU DOWNLOAD AND USE JAVA 17?
If you download the installer that usually comes in a msi installer it should then Autodetect it. More on reddit.com
🌐 r/PrismLauncher
14
19
June 22, 2023
how do i download java 17?
https://adoptium.net/temurin/releases/?version=17&package=jre More on reddit.com
🌐 r/PrismLauncher
8
6
November 10, 2024
How to get java 17?
🌐 r/Minecraft
15
1
December 20, 2021
🌐
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.
🌐
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.
🌐
Oracle
jdk.java.net › 17
JDK 17 Releases
JDK 17 has been superseded. Please visit jdk.java.net for the current version.
🌐
Oracle
java.com › 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.
🌐
Apple Support
support.apple.com › en-us › 106567
Java for Mac OS X 10.6 Update 17 - Apple Support
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
Find elsewhere
🌐
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 ...
🌐
Stony Brook University
www3.cs.stonybrook.edu › ~amione › CSE114_Course › materials › resources › InstallingJava17.pdf pdf
Installing Java 17 Downloading
Scroll down to Java SE Development Kit 17.0.2 downloads. Click on the appropriate platform ... For mac, use the x76 DMG installer.
🌐
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
September 22, 2021 -

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.

🌐
Oracle
oracle.com › java › technologies › javase › jdk17-0-13-later-archive-downloads.html
Java Archive Downloads - Java SE 17.0.13 and later
Commercial license and support are available for a low cost with Java SE Universal Subscription. WARNING: Older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. For production use Oracle recommends downloading the latest JDK version.
🌐
Red Hat
developers.redhat.com › products › openjdk › download
Download the Red Hat Build of OpenJDK | Red Hat Developer
July 25, 2024 - Red Hat build of OpenJDK is available for RHEL, Windows, and other Linux environments too as a Java Runtime Environment(JRE) and a complete Java Development Kit (JDK). Red Hat build of OpenJDK is not available for Mac.
🌐
OpenJDK
openjdk.org › projects › jdk › 17
JDK 17
JDK 17 is the open-source reference implementation of version 17 of the Java SE Platform, as specified by by JSR 390 in the Java Community Process.
🌐
Baeldung
baeldung.com › home › java › install java on macos
Install Java on macOS | Baeldung
April 14, 2024 - 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. Finally, we need to run the below command to check the installed Java version: % java -version java version "17...