Try the "export" plugin:

jenv enable-plugin export

You can check the Export plugin section in Readme.md at the jEnv Github repo (https://github.com/gcuisinier/jenv)

Answer from kimbaudi on Stack Overflow
🌐
GitHub
github.com › jenv › jenv
GitHub - jenv/jenv: Manage your Java environment · GitHub
If you executed this commands inside ... version was 17 and the shell version was 11, 11 would be used. Use jenv global VERSION to set a global, default Java version:...
Starred by 6.6K users
Forked by 398 users
Languages   Shell 99.0% | Dockerfile 1.0%
🌐
Medium
medium.com › @pranesh7 › java-version-management-with-jenv-cc79357180c9
Java version management with jenv | by Pranesh Satghare | Medium
December 2, 2025 - 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 ...
Discussions

bash - SET JAVA_HOME to reflect jenv java version - Stack Overflow
I just started to use jenv, I followed a blog post that was explaining how to use jenv and setup multiple java version on MacOSX. But the problem now I am running into is setting up the JAVA_HOME. ... More on stackoverflow.com
🌐 stackoverflow.com
react native - Changing Java version using jenv in a shell script - Stack Overflow
Something in your scripts sets these variables up and 'jenv' doesn't override them. ... Sign up to request clarification or add additional context in comments. ... Hmm. Seems unlikely. I removed all of the code that didn't involve changing the Java version and it still doesn't work. More on stackoverflow.com
🌐 stackoverflow.com
java - Not able to change the JDK in Mac OS using Jenv - Stack Overflow
I followed highly rated medium blog on Jenv to manage multiple version on Mac OS but still my default java version is not switching back to 1.8 and didn't get any error while following stackoverflow answer or medium post. ... Copy system 1.8 * 1.8.0.252 (set by /Users/my user/.jenv/version) ... More on stackoverflow.com
🌐 stackoverflow.com
How do I switch between Java versions?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
13
11
March 20, 2023
🌐
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 · $ jenv versions system oracle64-1.6.0.39 * oracle64-1.7.0.11 (set by /Users/hikage/.jenv/version)
🌐
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 - Navigate to the ../Home sub-directory and add that path to jEnv. 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.
🌐
GitHub
github.com › FelixSelter › JEnv-for-Windows
GitHub - FelixSelter/JEnv-for-Windows: Change your current Java version with one line · GitHub
This will set your JAVA_HOME for ... D:\Programme\Java\jdk-15.0.1 · Change your java version for the current session jenv use <name> Example: jenv use jdk15 Environment var for scripting: ---PowerShell: $ENV:JENVUSE="jdk17" ...
Starred by 916 users
Forked by 106 users
Languages   PowerShell 97.1% | Batchfile 2.9%
🌐
Baeldung
baeldung.com › home › java › managing multiple jdk installations with jenv
Managing Multiple JDK Installations With jEnv | Baeldung
May 2, 2025 - 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.
🌐
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 - ls /Library/Java/JavaVirtualMachines/ will tell you. jenv’s versions will provide you a list of the available versions on your system: $ jenv versions * system (set by /Users/rob/.jenv/version) 1.8 1.8.0.275 12 12.0 12.0.2 15 15.0 15.0.1 openjdk64-1.8.0.275 openjdk64-12.0.2 oracle64-15.0.1
Find elsewhere
🌐
MungingData
mungingdata.com › java › jenv-multiple-versions-java
Running Multiple Versions of Java on MacOS with jenv - MungingData
List the Java virtual machines with ls -1 /Library/Java/JavaVirtualMachines. Add Java 8 to jenv with jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/. Set the global Java version on your computer with jenv global openjdk64-1.8.0.265.
🌐
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 ... 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 that you must ...
🌐
Bring
developer.bring.com › blog › configuring-jenv-the-right-way
Configuring jenv the right way – Bring Developer
July 27, 2018 - You should be seeing the currently set version (which should be java 10.0 or 10.0.1 as per the above example) as you java version. If not, something’s not right, and you may not get the intended behaviour out of your jenv.
🌐
Reflectoring
reflectoring.io › manage-jdks-with-jenv
Managing Multiple JDK Installations With jEnv
October 18, 2022 - In this case, you might need to enable the export plugin, which sets the JAVA_HOME variable properly: ... Now, when you run a command like ./gradlew ... or ./mvnw ..., it should pick the correct Java version. More troubleshooting tips can be found on the official troubleshooting page. jEnv is a handy tool to manage multiple JDK versions between different projects.
🌐
My Developer Journal
sunitc.dev › 2021 › 04 › 23 › how-to-run-multiple-java-version-in-your-local-environment-using-jenv
How To Run multiple Java Version in your local environment using JENV – My Developer Journal
April 23, 2021 - Can be configured by running command – jenv local <java-version> ... This command creates a file – .java-version in the given directory. So even if we come back to this directory later, it will use the same JDK version that we had set earlier.
🌐
SitePoint
sitepoint.com › blog › java › how to run multiple versions of all your dev tools with jenv
How to Run Multiple Versions of All Your Dev Tools with Jenv — SitePoint
November 6, 2024 - Jenv allows you to easily switch between different versions of Java. To add a Java version to Jenv, use the command: jenv add /path/to/java. You can then set the global Java version with: jenv global oracle64-1.7.0.79.
🌐
Medium
medium.com › @oyvind.ahlstrom › setup-jenv-to-manage-multiple-java-environments-f1d896a31b5b
Setup jEnv to manage multiple Java environments | by Øyvind Ahlstrøm | Medium
January 30, 2020 - It only removes the reference from jEnv and will result in making the list of installed versions easier to read. Maven is often used as a tool with Java. To integrate Maven with jEnv write the following command: jenv enable-plugin maven jenv enable plugin export · The only thing remaining for your team is to set an active Java version.
🌐
OSTechNix
ostechnix.com › home › command line utilities › how to manage multiple java versions with jenv on linux
How To Manage Multiple Java Versions With jEnv On Linux - OSTechNix
June 27, 2020 - Now check all available Java versions to jenv using command: ... * system (set by /home/ostechnix/.jenv/version) 13 13.0 13.0.3 14 14.0 14.0.1 openjdk64-13.0.3 openjdk64-14.0.1
🌐
Atevans
atevans.com › 2019 › 04 › 26 › jenv-and-java-versioning.html
atevans - Jenv and Java Versioning
April 26, 2019 - $ brew install jenv $ eval "$(jenv init - zsh)" $ jenv enable-plugin export $ jenv add $(/usr/libexec/java_home) $ jenv versions * system (set by /Users/andrewevans/.jenv/version) 12 openjdk64-12
🌐
Bekk Christmas
bekk.christmas › post › 2022 › 16 › java-versions-are-easier-with-jenv
Java versions are easier with jEnv | Bekk Christmas
November 7, 2024 - If you want specific versions, first tap into cask/versions before suffixing the version number. ... Then, add it to jEnv by executing jenv add with the full path to the Java variable. Now that everything is set up, you can start working!
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.