The problem that you are seeing is because jenv is not setup properly for your terminal. Depending on your terminal, you should look at your .bash_profile or .zshrc and ensure that the following lines exist:

Copyexport PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"

You can test to see if jenv has been initialized properly in your terminal by running which java. If jenv is initialized properly you will see something like:

Copy/Users/your-username/.jenv/shims/java

If you don't see this, double check .bash_profile or .zshrc as described above. I also recommend that you place these at the end of the file so that you can be sure that jenv gets added onto the start of your PATH.

The magic behind jenv is jenv init. When you open your terminal this runs and updates your PATH to look at ~/.jenv/shims which contains a shim (shell script) which resolves your desired version of Java when you run java or other JRE/JDK commands.

Answer from Blaine on Stack Overflow
🌐
GitHub
github.com › jenv › jenv
GitHub - jenv/jenv: Manage your Java environment · GitHub
jenv adds multiple variants of each Java version assuming they have not already been added. This allows you to add multiple JDKs of the same major version and have a way to differentiate them.
Starred by 6.6K users
Forked by 398 users
Languages   Shell 99.0% | Dockerfile 1.0%
🌐
Jenv
jenv.be
jEnv - Manage your Java environment
jEnv is a command line tool to help you forget how to set the JAVA_HOME environment variable · Further Documentation
🌐
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 - Set up jEnv on macOS to quickly switch between Java versions per project.
🌐
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 - We'll create symlinks to versions ...xec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-21.jdk · jenv is a Java installation version manager....
🌐
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 supports Linux and MacOS only, but it is possible to install it on Windows by installing Windows Subsystem for Linux.
🌐
MungingData
mungingdata.com › java › jenv-multiple-versions-java
Running Multiple Versions of Java on MacOS with jenv - MungingData
Set the global Java version on your computer with jenv global openjdk64-1.8.0.265. The exact command on your machine might be something slightly different like jenv global openjdk64-1.8.0.272.
Top answer
1 of 4
41

The problem that you are seeing is because jenv is not setup properly for your terminal. Depending on your terminal, you should look at your .bash_profile or .zshrc and ensure that the following lines exist:

Copyexport PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"

You can test to see if jenv has been initialized properly in your terminal by running which java. If jenv is initialized properly you will see something like:

Copy/Users/your-username/.jenv/shims/java

If you don't see this, double check .bash_profile or .zshrc as described above. I also recommend that you place these at the end of the file so that you can be sure that jenv gets added onto the start of your PATH.

The magic behind jenv is jenv init. When you open your terminal this runs and updates your PATH to look at ~/.jenv/shims which contains a shim (shell script) which resolves your desired version of Java when you run java or other JRE/JDK commands.

2 of 4
4

Behind the scenes jenv uses the /Library/Java/JavaVirtualMachines directory.

Then you could also type /usr/libexec/java_home -V to show all the available JDKs and analyse your issue:

CopyMatching Java Virtual Machines (4): 
11.0.2_2-OracleJDK, x86_64: "Java SE 11.0.2" /Library/Java/JavaVirtualMachines/OracleJDK-jdk-11.0.2.jdk/Contents/Home 
11.0.2_1-OpenJDK, x86_64: "OpenJDK 11.0.2" /Library/Java/JavaVirtualMachines/OpenJDK-jdk-11.0.2.jdk/Contents/Home 
1.8.0_11, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home 
1.7.0_45, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home 

/Library/Java/JavaVirtualMachines/OracleJDK-jdk-11.0.2.jdk/Contents/Home

In this exemple export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) set the JDK 1.8 version.

Thus, you even could define the following aliases:

Copyjava11_OpenJDK_export='export JAVA_HOME=$(/usr/libexec/java_home -v 11.0.2_1-OpenJDK)'
java11_OracleJDK_export='export JAVA_HOME=$(/usr/libexec/java_home -v 11.0.2_2-OracleJDK)'
java7_export='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)'
java8_export='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)'

NB: The version to use after java_home -v is defined in each JDK installation in the Contents/Info.plist file section JVMVersion.

I changed it, to easily switch between the OpenJDK and the Oracle JDK:

Copy$ tail -5 /Library/Java/JavaVirtualMachines/OpenJDK-jdk-11.0.2.jdk/Contents/Info.plist | head -2
<key>JVMVersion</key>
<string>11.0.2_1-OpenJDK</string>

$ tail -5 /Library/Java/JavaVirtualMachines/OracleJDK-jdk-11.0.2.jdk/Contents/Info.plist | head -2
<key>JVMVersion</key>
<string>11.0.2_2-OracleJDK</string>

So, in your case as you have two 1.8 versions (1.8 and 1.8.0.252). It is more than likely that you should update their Contents/Info.plist file section JVMVersion.

🌐
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 - Firstly install jenv, the latest Java (15 at this time) and any other versions you need.
Find elsewhere
🌐
LinuxTut
linuxtut.com › en › 87b75113da8fb2683f00
[JAVA] Install and configure jenv on macOS
January 25, 2020 - jenv shell 11.0.2 · Install Java 8 where Java 11.0.2 is installed · brew cask install adoptopenjdk8 brew cask install caskroom/versions/adoptopenjdk8 · Install the latest version of Java 8 in a special directory on macOS by the above · $ ls -1 /Library/Java/JavaVirtualMachines adoptopenjdk-8.jdk openjdk-11.0.2.jdk ·
🌐
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.
🌐
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 - For anyone who needs to have many different versions of Java installed on their macOS machine. It goes over installation of `jenv` and various JDKs as well as how to switch between them
🌐
Medium
medium.com › @danielnenkov › multiple-jdk-versions-on-mac-os-x-with-jenv-5ea5522ddc9b
Multiple JDK versions on Mac OS X with jEnv | by Daniel Nenkov | Medium
November 9, 2017 - Multiple JDK versions on Mac OS X with jEnv I bought a new laptop recently and had to set it up for development. I installed JDK with brew which downloaded and configured Java 9. I knew I will have …
🌐
Baeldung
baeldung.com › home › java › managing multiple jdk installations with jenv
Managing Multiple JDK Installations With jEnv | Baeldung
May 2, 2025 - jEnv supports Linux and MacOS operating systems. Moreover, it supports Bash and Zsh shells.
🌐
Mtnr
mtnr.cloud › install-java-using-homebrew-and-jenv-on-macos
Install Java using Homebrew and jEnv on MacOS – mtnr
Sometimes it’s desirable to use different Java versions. Here’s one way how to do it on a Mac. If you haven’t already, install Homebrew as a first step. $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Now, that Homebrew is installed, install jEnv, next.
🌐
MacPorts
ports.macports.org › port › jenv
Install jenv on macOS with MacPorts
If not done already, install MacPorts. To install jenv, run the following command in macOS terminal (Applications->Utilities->Terminal)
🌐
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 the cask-versions tap to Homebrew: brew tap homebrew/cask-versions ·
🌐
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 ?

🌐
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 …