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

🌐
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.
Discussions

How to install Java on Macbook
Hello guys i need to install java(not java script) i dont understand how,i installed in oracle " jdk23" i watched a youtube video where the youtuber writes something in terminal i dont get it : More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
0
October 9, 2024
how do i download Java 17
Upvote this comment if this is a good quality post that fits the purpose of r/Minecraft Downvote this comment if this post is poor quality or does not fit the purpose of r/Minecraft Downvote this comment and report the post if it breaks the rules (Vote has already ended) More on reddit.com
🌐 r/Minecraft
3
4
October 11, 2025
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 to install java on Mac m1?
I read somewhere last week that there is a new M1 version of Java runtime coming. But I could not find it today when I searched. More on reddit.com
🌐 r/MacOS
15
6
September 29, 2021
🌐
Oracle
docs.oracle.com › en › java › javase › 17 › install › installation-jdk-macos.html
5 Installation of the JDK on macOS - Java
April 21, 2026 - The JDK supports both Intel-based (x64) and Apple Silicon (AArch64) Mac computers. ... For supported processors and browsers, see Oracle JDK Certified Systems Configurations. JDK installers now support only one version of any Java feature release. You can't install multiple versions of the same feature release. For example, you can't install jdk-17 and jdk-17.0.1 simultaneously.
🌐
Oracle
oracle.com › java › technologies › downloads
Download the Latest Java LTS Free
Commercial license and support are available for a low cost with Java SE Universal Subscription. JDK 17.0.19 checksums and OL 9 GPG Keys for RPMs · Linux · macOS · Windows · Solaris · Documentation Download · Online Documentation · Installation Instructions ·
🌐
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.
🌐
Snyk
snyk.io › blog › install-java-on-macos
How to install Java on macOS | Snyk
April 17, 2024 - Before starting the installation process, you should first check if Java is already installed on your macOS. To do this, open the Terminal application and run the following command: ... If Java is already installed on your system, this command will display the current version. If not, Terminal will prompt you to install a JDK. Homebrew is a free and open source software package management system that simplifies the installation of software on macOS.
🌐
Se-education
se-education.org › guides › tutorials › javaInstallationMac.html
Java 17 Installation Guide for Mac Users
This guide explains how to install the (specifically, Java 17 JDK+FX Azul distribution) on macOS using SDKMAN.
Find elsewhere
🌐
Java With Us
javawithus.com › home › faq › how to install java 17 on mac
How to Install Java 17 on Mac | Java With Us
April 21, 2026 - Install Java 17 on Mac via brew install openjdk@17, symlink it, and switch with java_home. Full steps for Apple Silicon and Intel.
🌐
Tutorials24x7
java.tutorials24x7.com › blog › how-to-install-java-17-on-mac
How To Install Java 17 On Mac | Tutorials24x7
September 27, 2021 - Open the download link to select the available versions as shown in Fig 3. ... Click the Download Option as highlighted in Fig 3. Double click the DMG file downloaded in the previous step to start installing Oracle JDK 17 on Mac.
🌐
Brainly
brainly.com › computers and technology › high school › how do you download and install java 17 on a mac?
[FREE] How do you download and install Java 17 on a Mac? - brainly.com
November 27, 2023 - Select the Download Package: Look for the Java SE 17 download option and click on it. You will see different options depending on your operating system. Make sure to choose the one for macOS.
🌐
Baeldung
baeldung.com › home › java › install java on macos
Install Java on macOS | Baeldung
April 14, 2024 - Another way to install Java is via the command line. To accomplish this, we can use Homebrew, a popular package manager for macOS. Let’s see the steps for installing OpenJDK using Homebrew. Before we start, first, let’s make sure Homebrew is installed and up-to-date: ... % brew search openjdk ==> Formulae openjdk ✔ openjdk@11 openjdk@17 ✔ openjdk@8 openj9 openjph openvdb ==> Casks adoptopenjdk
🌐
Oracle
java.com › en › download › apple.jsp
Java for Mac
如果您在 macOS Intel (x86_64) 上运行,请下载 x86_64 版本的 JRE.
🌐
Stony Brook University
www3.cs.stonybrook.edu › ~amione › CSE114_Course › materials › resources › InstallingJava17.pdf pdf
Installing Java 17 Downloading
To install the latest version of Java, go to the download site at Oracle.com. Scroll down to Java SE Development Kit 17.0.2 downloads. Click on the appropriate platform ... For mac, use the x76 DMG installer.
🌐
CodeJava
codejava.net › java-se › install-oracle-jdk-17-on-macos
Download and Install Oracle JDK 17 on macOS
April 28, 2022 - Head over to the official download page of Oracle JDK 17. You will see the following page:Click the link next to Arm 64 DMG Installer if your Mac running on Apple’s CPU, else click the link next to x64 DMG Installer for Intel’s CPU.And you should verify SHA256 checksum of the downloaded ...
🌐
javathinking
javathinking.com › blog › jdk-17-install-mac
Installing JDK 17 on macOS: A Comprehensive Guide — javathinking.com
Installation Methods 2.1 Install via Homebrew (Recommended for Most Users) 2.2 Manual Install Using Eclipse Temurin (Open-Source, Free) 2.3 Install via SDKMAN! (For Version Management) ...
🌐
Java With Us
javawithus.com › home › faq › how to install java 17 on windows, mac and linux
How to Install Java 17 on Windows, Mac and Linux | Java With Us
April 21, 2026 - Install Java 17 LTS on any OS: winget or Temurin MSI on Windows, brew install openjdk@17 on Mac, apt install openjdk-17-jdk on Ubuntu.
🌐
MacPorts
ports.macports.org › port › jdk17
Install jdk17 on macOS with MacPorts
This software is provided under the Oracle No-Fee Terms and Conditions (NFTC) license (https://java.com/freeuselicense). Oracle JDK 17.0.13 and later are only available under the OTN license and therefore cannot be made available via MacPorts. If you require an up-to-date JDK 17, consider ...
🌐
freeCodeCamp
forum.freecodecamp.org › t › how-to-install-java-on-macbook › 715540
How to install Java on Macbook - The freeCodeCamp Forum
October 9, 2024 - Hello guys i need to install java(not java script) i dont understand how,i installed in oracle " jdk23" i watched a youtube video where the youtuber writes something in terminal i dont get it :
🌐
TheBreakdown.xyz
thebreakdown.xyz › home › how to download & install java on mac
How To Download & Install Java on Mac - TheBreakdown.xyz
February 8, 2022 - First things first, we need to download Java for macOS. You can get to the Java download page by clicking the Download Java button above. You can also click this link to get to the Java download page.