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
This will create a .java-version file we can check into Git for our projects, and jenv will load it correctly when a shell is started from this directory. ... Yes! Observe that JAVA_HOME is set to a valid shim directory - this is a result of enabling the export plugin. If you executed this commands inside your $HOME directory, you can now delete .java-version: ... Where multiple versions are set, the highest priority setting as above takes effect. For example if the global version was 17 and the shell version was 11, 11 would be used.
Starred by 6.6K users
Forked by 398 users
Languages   Shell 99.0% | Dockerfile 1.0%
🌐
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.
🌐
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 - You can see the installed versions by echo ${JAVA_HOME} $ 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
🌐
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 - You can check added java versions in jEnv with this command. ... * system (set by /Users/yeminko/.jenv/version) 17 17.0 17.0.12 21 21.0 21.0.4 openjdk64-17.0.12 openjdk64-21.0.4
🌐
Bekk Christmas
bekk.christmas › post › 2022 › 16 › java-versions-are-easier-with-jenv
Java versions are easier with jEnv | Bekk Christmas
November 7, 2024 - The easiest way is to set the Java version you use the most as default. For example, with Java 17: jenv global 17 . In the microservice you are using another version, for example Java 15, simply run jenv local 15 .
🌐
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
🌐
Jenv
jenv.be
jEnv - Manage your Java environment
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc $ echo 'eval "$(jenv init -)"' >> ~/.zshrc
🌐
javaspring
javaspring.net › blog › jenv-install-java-17
Mastering Java 17 Installation with jEnv — javaspring.net
If you want to use Java 17 only for a specific project, you can set it as the local Java version. Navigate to the project directory and run: ... This will create a .java - version file in the project directory, which jEnv will use to determine ...
🌐
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 - The 'jenv version' command only gives you the current version. The command should be 'jenv local'. Thanks for the updates John! I've noted them in the article. Pingback: Not able to switch Java version to Java 17 – Rubin Shrestha
🌐
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:
🌐
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 ...
🌐
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 - javahome() { jenv shell $1 java -version } alias j17='javahome 17' alias j18='javahome 18' alias j20='javahome 20' alias j21='javahome 21'
🌐
Reddit
reddit.com › r/commandline › macos - jenv local, without a ".java-version" file ?
r/commandline on Reddit: MacOS - jenv local, without a ".java-version" file ?
August 14, 2024 -

Basically, on my work mac machine, I'd like to use multiple different JDKs - a default global graalvm-22, an Android Studio embedded OpenJDK-17, an IntelliJ Idea CE embedded JBR-21 etc.

Figured, 'jenv' is a useful tool, from 'brew'.

Nevertheless, `jenv local 17` on my android project source-code root-folder, is introducing a file '.java-version'. I'd rather avoid such a file in a folder managed by 'git', so no edits to '.gitignore', and no "untracking", and don't want to disrupt the remote project source-code repo for the rest of the engineers on the team either.

Therefore, all I intend to do, in "zsh" profile - like a ".zprofile" ( which I've already setup ), or a ".zshenv", or a ".zshrc" whichever one works -

If "$(pwd)" is project source-code root repository folder, then enforce jenv 17 locally only.

Is that something that's possible ? Could that be a one-liner, or do we need multiple lines, and source it from a different script-file ?

🌐
MacPorts
ports.macports.org › port › jenv › details
jenv | MacPorts
Set a global default Java: jenv global 17 · Set a local Java version for a specific directory: cd /path/to/java/11/project jenv local 11 · See https://github.com/jenv/jenv for more information. Loading Port Health · Quick Links: About · Statistics FAQ · Git Repository ·
🌐
Baeldung
baeldung.com › home › java › managing multiple jdk installations with jenv
Managing Multiple JDK Installations With jEnv | Baeldung
May 2, 2025 - Running the jenv version command in the absence of a local JDK version will display the global JDK version. Let’s set a local JDK version for this directory: ... This command sets the local JDK in the ~/baeldung-project directory. Setting the local JDK basically creates a file called .java-version in the current directory.
🌐
GitHub
github.com › jenv › jenv › issues › 344
Jenv not able to recognize Java 17 · Issue #344 · jenv/jenv
December 5, 2021 - So, the java version was temporarily updated to Java 17. However, as soon as I restart a new terminal, it is going back to Java 11. I think, it is due to the fact that jenv gets initialized on the new terminal due to following line in .zshrc file, and the default version is Java 11:
Author   jenv
🌐
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 - Guide for build and deploy Java Applications. Practice with JakartaEE, Quarkus, Spring-Boot and more. ... This post describes how to set up OpenJDK 11 and OpenJDK 17 on macOS, and it also provides a solution for switching between these 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
🌐
Medium
medium.com › @pranesh7 › java-version-management-with-jenv-cc79357180c9
Java version management with jenv | by Pranesh Satghare | Medium
December 2, 2025 - I installed jenv in a few minutes, ran a couple of commands, and suddenly… everything worked. No more PATH drama. No more “why is Java 17 showing when I’m in a Java 8 project?” No more breaking builds because my system forgot which version I told it to use yesterday.