Found that you need to register the java-17 dist in jenv using command:

Copyjenv add /usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home 

The path to /usr/local/opt/openjdk@17/libexec/openjdk.jdk you may take from your brew installation logs (found on the line sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk ...) and just add /Contents/Home

Now, it works

Copy> jenv local 17.0
> java -version                                                                                                                                     
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment Homebrew (build 17.0.1+1)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.1+1, mixed mode, sharing)
Answer from lazylead on Stack Overflow
🌐
GitHub
github.com › jenv › jenv
GitHub - jenv/jenv: Manage your Java environment · GitHub
Use your platform appropriate package manager to install java. On macOS, brew is recommended. This document will show you how to install jenv, review its most common commands, show example workflows and identify known issues.
Starred by 6.6K users
Forked by 398 users
Languages   Shell 99.0% | Dockerfile 1.0%
Discussions

macOS - How to install Java 17 - Stack Overflow
Could someone please let me know the steps to install Java on a Mac. I did brew install java I get this Warning: openjdk 17.0.1 is already installed and up-to-date. To reinstall 17.0.1, run: brew More on stackoverflow.com
🌐 stackoverflow.com
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
MacOS - jenv local, without a ".java-version" file ?
I have the same situation and I use https://github.com/jdx/mise - multiple languages and multiple versions. Best of all, mise can understand the language-specific tool configuration file (as opposed to introducing yet another config file that the whole team needs to be watchful of when upgrading versions) More on reddit.com
🌐 r/commandline
7
3
August 14, 2024
Modern Java Practices

Java 15 is the current LTS ("long-term support") version

No it is not. Java 15 is only updated/patched until next release, which means for 6 months. LTS is something a company chooses to support for a long period of time. Oracle supports Java 8, Java 11, Java 17 (next LTS). Same for Redhat. I think Azure support Java 14 as LTS as well.

In general, you will find that AdoptOpenJDK is a go-to choice for obtaining the JDK.

You should go to official OpenJDK site to get your JDK.

Lombok

Section on Lombok. I would add a big warning or note. If you're promoting newest Java versions, I guess you know, that records have landed and in Java 16 they will be a standard feature. Combine it with upcoming withers and you can write:

record Point(int x, int y) {}
Point p;
Point pp = p with { x = 3; }

Lombok has a lot of problems, funnily enough, it broke IntelliJ recently and they had to do an emergency patching.

P.s. I can make a pull request for these suggested changes.

More on reddit.com
🌐 r/programming
84
58
October 8, 2020
🌐
javaspring
javaspring.net › blog › jenv-install-java-17
Mastering Java 17 Installation with jEnv — javaspring.net
In the ever-evolving world of Java ... between different Java versions on your system. In this blog post, we will delve into the details of using jEnv to install Java 17, exploring its fundamental concepts, usage methods, common practices, and best practices....
🌐
Jenv
jenv.be
jEnv - Manage your Java environment
$ jenv add /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home oracle64-1.6.0.39 added $ jenv add /Library/Java/JavaVirtualMachines/jdk17011.jdk/Contents/Home oracle64-1.7.0.11 added
🌐
Medium
ymkfelix.medium.com › how-to-set-up-multiple-java-versions-on-a-macbook-8bae41345f72
How to set up multiple Java versions on a MacBook? | by Ye Min Ko | Medium
August 13, 2024 - sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk sudo ln -sfn /opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-21.jdk · Now install jEnv.
🌐
Medium
medium.com › javarevisited › manage-java-versions-with-jenv-6b8228552661
Manage Java Versions with jEnv. Master your Java Environment | by Jayson GCS | Javarevisited | Medium
September 11, 2023 - jenv add /opt/homebrew/Cellar/openjdk@17/17.0.8.1/libexec/openjdk.jdk/Contents/Home/ ... Verify that all the intended versions are correctly added to jEnv. ... Finally, we have a convenient setup to switch between Java versions seamlessly.
🌐
Thejavaguy
thejavaguy.org › posts › 002-use-jenv-to-manage-jdks
Use jEnv to manage JDKs - TheJavaGuy Software & Blog
March 17, 2022 - # ivanmilosavljevic @ TJG in ~ [13:59:08] $ jenv global 17 # ivanmilosavljevic @ TJG in ~ [13:59:11] $ java -version openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-39) OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)
Find elsewhere
🌐
Mehmet Baykar
mehmetbaykar.com › home › macos › how to set up jenv on macos
How to Set Up jEnv on macOS | Mehmet Baykar
December 27, 2025 - Before you can add Java versions to jEnv, you need to ensure that the Java Development Kit (JDK) is properly linked to a location that jEnv can access. First, install the desired Java versions using Homebrew. For example, to install Java 11 and 17:
🌐
Bekk Christmas
bekk.christmas › post › 2022 › 16 › java-versions-are-easier-with-jenv
Java versions are easier with jEnv | Bekk Christmas
November 7, 2024 - ... Then, add it to jEnv by executing ... way is to set the Java version you use the most as default. For example, with Java 17: jenv global 17 ....
🌐
Rob Allen
akrabat.com › using-jenv-to-select-java-version-on-macos
Using jenv to select Java version on macOS – Rob Allen
December 2, 2020 - $ jenv add /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/ $ jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk/Contents/Home/ $ jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/ The exact ...
🌐
DEV Community
dev.to › blaytenshi › installing-multiple-java-on-macos-managed-by-jenv-l6i
Installing (multiple) Java on MacOS managed by jEnv - DEV Community
October 7, 2024 - Add the versions in Java VM folder to jenv so it can manage them jenv add /Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home/ jenv add /Library/Java/JavaVirtualMachines/openjdk-21.jdk/Contents/Home/
🌐
Will Warren
willwarren.com › 2023 › 11 › 28 › install-multiple-jdks-with-jenv-and-homebrew-on-macos
Install and Use Multiple JDKs with jenv and Homebrew on macOS | Will Warren
November 28, 2023 - brew tap homebrew/cask-versions brew search temurin # this will list all the versions you can install brew install --cask temurin17 temurin20 temurin21 # etc... ... jenv add /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home jenv add /Library/Java/JavaVirtualMachines/temurin-20...
🌐
Medium
medium.com › java-mvp › guide-setting-up-and-switching-between-java-11-and-17-on-macos-9caff4c96e2d
Guide: Setting Up and Switching between Java 11 and 17 on macOS | by datatec.studio | Java MVP | Medium
November 25, 2023 - ... This post describes how to ... two versions. Table of Content Step 1: Install OpenJDK 11 Step 2: Install OpenJDK 17 Step 3: jenv — Make Switching between Java 11 and 17 possible...
🌐
Readthedocs
metadatacenter.readthedocs.io › en › latest › install-developer › prereq-jenv
Jenv - CEDAR - Read the Docs
In order to manage the multiple ... command will be executed Register all the JDKs that you might have on your system into jenv: jenv add /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/ ......
🌐
Baeldung
baeldung.com › home › java › managing multiple jdk installations with jenv
Managing Multiple JDK Installations With jEnv | Baeldung
May 2, 2025 - The good thing about jEnv is that we don’t need to install the JDK via a package manager. We can simply download a JDK and put it into a folder somewhere. Firstly, to use the new JDK with jEnv, we need to tell jEnv where to locate it.
🌐
Adam Gamboa G
blog.adamgamboa.dev › using-jenv-to-switch-jkd-versions
Using jEnv to switch JDK versions
December 24, 2021 - It might be very common to require ... or Java 17, or any other version, while you are working on different projects or applications. One way to switch Java’s version is setting the JAVA_HOME env-var to the installation directory of the desire version. To help with that work jEnv is a tool ...
🌐
Medium
medium.com › @pranesh7 › java-version-management-with-jenv-cc79357180c9
Java version management with jenv | by Pranesh Satghare | Medium
December 2, 2025 - Install Jenv on your Mac or Linux with the help of following link https://www.jenv.be/ ... jenv add /Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home jenv add /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home jenv add /Library/Java/JavaVirtualMachines/openjdk-17.jdk/Contents/Home
🌐
GitHub
gist.github.com › leifericf › f61c60a9ab889ed752f969e9db2009a0
Installing Java on macOS and Adding It to jEnv · GitHub
system 1.8 1.8.0.392 21.0 21.0.1 temurin64-1.8.0.392 * temurin64-21.0.1 (set by /Users/<user>/.jenv/version) The star (*) indicates that we have successfully set temurin64-21.0.1 globally. We can set a local version of Java for the current working directory: ... This will create a file called .java-version which specifies the Java version to use for this directory. ... openjdk 21.0.1 2023-10-17 LTS OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
🌐
MungingData
mungingdata.com › java › jenv-multiple-versions-java
Running Multiple Versions of Java on MacOS with jenv - MungingData
Find the exact name of the version with jenv versions. Check to make sure the javac -version and java -version commands are working. Macs come with Java preinstalled. It's always good to avoid using system installed programming language versions (applies to Python and Ruby too).
Top answer
1 of 13
407

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.