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
🌐
Homebrew
formulae.brew.sh › formula › jenv
Homebrew Formulae: jenv
brew install jenv · Manage your Java environment · https://github.com/jenv/jenv · License: MIT · Development: Pull requests · Formula JSON API: /api/formula/jenv.json · Formula code: jenv.rb on GitHub · Bottle (binary package) installation support provided.
🌐
GitHub
github.com › jenv › jenv
GitHub - jenv/jenv: Manage your Java environment · GitHub
On macOS, you can install jEnv using Homebrew: brew install jenv · Or if you use MacPorts on macOS: sudo port install jenv ·
Starred by 6.6K users
Forked by 398 users
Languages   Shell 99.0% | Dockerfile 1.0%
🌐
Baeldung
baeldung.com › home › java › managing multiple jdk installations with jenv
Managing Multiple JDK Installations With jEnv | Baeldung
May 2, 2025 - $ jenv doctor [OK] No JAVA_HOME set [ERROR] Java binary in path is not in the jenv shims. [ERROR] Please check your path, or try using /path/to/java/home is not a valid path to java installation. PATH : /opt/homebrew/Cellar/jenv/0.5.4/libexec/libexec:/Users/jenv/.jenv/shims:/Users/user/.jenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin [OK] Jenv is correctly loaded
🌐
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 - jenv add /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home jenv add /Library/Java/JavaVirtualMachines/temurin-20.jdk/Contents/Home # ...
🌐
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.
🌐
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 - $ jenv versions * system (set by /Users/user/.jenv/version) 17 17.0 17.0.12 21 21.0 21.0.4 openjdk64-17.0.12 openjdk64-21.0.4 · $ java -version openjdk version "17.0.12" 2024-07-16 OpenJDK Runtime Environment Homebrew (build 17.0.12+0) OpenJDK 64-Bit Server VM Homebrew (build 17.0.12+0, mixed mode, sharing)
🌐
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
🌐
DEV Community
dev.to › gabethere › installing-java-on-a-mac-using-homebrew-and-jevn-12m8
Brew Install Java: Installing Java on MacOS using Homebrew and JEnv - DEV Community
August 28, 2020 - $ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(jenv init -)"' >> ~/.bash_profile ... Note: It's important that now you restart your bash terminal or run . ~/.zshrc to reload your .zshrc now that we have added a new command shortcut. Now let's go ahead and download a brew cask for the jdk version that we are after. Before we go and download the version that we need, ensure that you run the following command to add the brew repo to your machine (https://github.com/AdoptOpenJDK/homebrew-openjdk).
Find elsewhere
🌐
Medium
medium.com › ayuth › set-up-multiple-java-dev-environments-for-macos-2025-edition-5aa4335f3d70
Set up Multiple Java Dev Environments for macOS — 2025+ Edition
November 3, 2025 - $ brew install jenv ==> Fetching downloads for: jenv ==> Downloading https://ghcr.io/v2/homebrew/core/jenv/manifests/0.5.9 Already downloaded: /Users/ayuth/Library/Caches/Homebrew/downloads/9027b15da7ef5210164c80246e675d8c3bccdf0dcc361f9c37663b81207284cd--jenv-0.5.9.bottle_manifest.json ==> Fetching jenv ==> Downloading https://ghcr.io/v2/homebrew/core/jenv/blobs/sha256:b454f9bfe4726a30422faed10c3fa103050a5dcb0fa39f366691bda9 Already downloaded: /Users/ayuth/Library/Caches/Homebrew/downloads/f37afca1709fc46f03b057d7f238c465a365e87f71f784c7e66c3765c9a96716--jenv--0.5.9.all.bottle.tar.gz ==> Pouring jenv--0.5.9.all.bottle.tar.gz ==> Caveats To activate jenv, add the following to your shell profile e.g.
🌐
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 - When working on OpenWhisk, I discovered that it needed a different Java to the one I had installed. Looking around the Internet, I discovered jenv which shouldn’t have surprised me as I use pyenv and I’m aware of rbenv too. As I use Homebrew, these are the commands I used.
🌐
Atevans
atevans.com › 2019 › 04 › 26 › jenv-and-java-versioning.html
atevans - Jenv and Java Versioning
April 26, 2019 - I had to manually add the “jenv init” and “enable-plugin” to my shell init scripts. Anyway, let’s try Java 11, as 11 is slightly less than 12 and 53 is slightly less than 56. $ brew tap homebrew/cask-versions $ brew cask install java11 $ jenv add /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home $ jenv local 11.0 $ jenv shell 11.0
🌐
Liangzhou
liangzhou.dev › home › manage multiple java versions on mac o s using brew and jenv
Manage multiple java versions on macOS using brew and jenv - TODO Learn More
➜ ~ brew update ➜ ~ brew install jenv /usr/local/Cellar/jenv/0.4.4: 78 files, 66KB, built in 1 second ➜ ~ which jenv /usr/local/bin/jenv ➜ ~ jenv --version jenv 0.4.4 ➜ ~ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc ➜ ~ echo 'eval "$(jenv init -)"' >> ~/.zshrc
🌐
Medium
medium.com › @cmonzon › setting-up-java-in-macos-using-jenv-and-homebrew-58598b09283f
Setting up Java in MacOS using jenv and Homebrew - Carlos Monzón - Medium
August 30, 2024 - Setting up Java in MacOS using jenv and Homebrew Full documentation: https://github.com/jenv/jenv 1. Install Homebrew 2. Install jenv brew install jenv Don’t forget to activate jenv, otherwise the …
🌐
GitHub
gist.github.com › leifericf › f61c60a9ab889ed752f969e9db2009a0
Installing Java on macOS and Adding It to jEnv · GitHub
Installing Java on macOS and Adding It to jEnv · Raw · install-java-macos.md · Install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Install jEnv using Homebrew: brew install jenv · Add ...
🌐
Mr N
bigsoft.co.uk › blog › 2025 › 11 › 07 › installing-all-the-javas-on-a-mac-and-switching-between-them
Installing all the Javas on a Mac and switching between them
November 7, 2025 - $ jenv global 11 $ echo $JAVA_HOME /Users/mrn/.jenv/versions/11 $ java -version openjdk version "11.0.29" 2025-10-21 OpenJDK Runtime Environment Homebrew (build 11.0.29+0) OpenJDK 64-Bit Server VM Homebrew (build 11.0.29+0, mixed mode)
🌐
GitHub
github.com › jenv › jenv › releases
Releases · jenv/jenv
Homebrew/homebrew-core#165928 · Merge pull request #405 from jsoref/add-no-args Gracefully handle jenv add · Merge pull request #349 from stirlingcarter/master docs: fix jenv versions command · Merge pull request #414 from nfawcett/issue-328-show-remove-in-useful-command-list show remove in useful command list ·
Author   jenv