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 OverflowVideos
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 ?