๐ŸŒ
GitHub
github.com โ€บ jenv โ€บ jenv
GitHub - jenv/jenv: Manage your Java environment ยท GitHub
jenv gives you a few critical affordances for using java on development machines: It lets you switch between java versions.
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 - # Switch the local directory to the desired Java version jenv local 11.0.20.1 # Verify the currently selected Java version cat .java-version
Discussions

react native - Changing Java version using jenv in a shell script - Stack Overflow
I have a React Native project where ... the Java versions before and after the script has been executed. I basically need to change to Java 1.8 to run commands connected to the android sdkmanager, and then switch back to Java 11 when done. I am currently using jenv to manage Java ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
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. As I switch java environment using jenv I want to make sure JAVA_HOME on my bash_profile also ... 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. 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
๐ŸŒ
GitHub
github.com โ€บ FelixSelter โ€บ JEnv-for-Windows
GitHub - FelixSelter/JEnv-for-Windows: Change your current Java version with one line ยท GitHub
Add a new Java environment (requires absolute path) jenv add <name> <path> Example: jenv add jdk15 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 ...
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 - It basically sets JAVA_HOME inside our shell in a way that can be set globally, locally to the current working directory, or per shell. It lets us quickly switch between different Java versions.
๐ŸŒ
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 ... You can do similar set up in each of your project with respective version of java. And boomโ€ฆ Thats it. It creates .java-version file on project, and if want to ignore it, you can add it in .gitignorefile. This saves tons of my time while switching between java versions.
๐ŸŒ
MungingData
mungingdata.com โ€บ java โ€บ jenv-multiple-versions-java
Running Multiple Versions of Java on MacOS with jenv - MungingData
system 1.8 1.8.0.272 11 11.0 11.0.9 openjdk64-1.8.0.272 * openjdk64-11.0.9 (set by /Users/powers/Documents/code/my_apps/delta-examples/.java-version) jenv's ability to automatically switch Java versions for different projects is quite convenient.
๐ŸŒ
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 ...
Find elsewhere
๐ŸŒ
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)
๐ŸŒ
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 - adoptopenjdk has been officially discontinued upstream. It may stop working correctly (or at all) in recent versions of macOS. Awesome compilation. Works like a charm. In between, to jenv switch reflect in $JAVA_HOME jenv enable-plugin export
๐ŸŒ
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 - 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. ... Now letโ€™s see how we can set th Default or Global JDK. Once we do this, we will use this JDK everywhere (except where we have local JDK configured) So we have seen how we can easily configure different JDKs using JENV and effortlessly switch between them.
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.

๐ŸŒ
Reflectoring
reflectoring.io โ€บ manage-jdks-with-jenv
Managing Multiple JDK Installations With jEnv
October 18, 2022 - Today, if weโ€™re working on multiple ... version. jEnv is a tool that helps us to manage multiple JDK installations and configure each codebase to use a specific JDK version without having to change the JAVA_HOME environment variable...
๐ŸŒ
Bring
developer.bring.com โ€บ blog โ€บ configuring-jenv-the-right-way
Configuring jenv the right way โ€“ Bring Developer
July 27, 2018 - You mostly only will need to use jenv local to set the java version for your project.
๐ŸŒ
The AEM Maven
theaemmaven.com โ€บ post โ€บ switching-java-sdk-with-jenv
Switching Java SDK with jEnv - The AEM Maven
June 27, 2022 - There are 3 ways to do this using one of the version tokens listed with jenv versions. Set the global version. This will be the version set by default whenever you open a shell. Set the local version. This creates a file named .java-version in the current directory.
๐ŸŒ
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 - Resumerably, you can switch it off with the following if you don't want it later. ... Add the paths to the JAVA_HOMEs. I've just shown the output from one of them so you can see. $ jenv add /usr/local/opt/openjdk@8 $ jenv add /usr/local/opt/openjdk@11 openjdk64-11.0.29 added 11.0.29 added 11.0 added 11 added $ jenv add /usr/local/opt/openjdk@17 $ jenv add /usr/local/opt/openjdk@21 $ jenv add /usr/local/opt/openjdk@25 ... $ jenv versions * system (set by /Users/mrn/.jenv/version) 1.8 1.8.0.472 11 11.0 11.0.29 17 17.0 17.0.17 21 21.0 21.0.9 25 25.0 25.0.1 openjdk64-1.8.0.472 openjdk64-11.0.29 openjdk64-17.0.17 openjdk64-21.0.9 openjdk64-25.0.1
๐ŸŒ
Medium
medium.com โ€บ @jainnitesh โ€บ how-to-manage-multiple-java-versions-on-macos-with-jenv-f26d9d06e510
How to Manage Multiple Java Versions on macOS with jenv | by Nitesh Jain | Medium
November 6, 2025 - Switch projects, and your Java version switches too. No manual exports, no mess. Enable build tool plugins so they pick the right Java version automatically: jenv enable-plugin maven jenv enable-plugin gradle
๐ŸŒ
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.