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
To have JAVA_HOME get set by jEnv, enable the export plugin. This needs to be done in an initialised shell: eval "$(jenv init -)" # if not already restarted your shell jenv enable-plugin export · Restart your shell by closing and reopening ...
Starred by 6.6K users
Forked by 398 users
Languages   Shell 99.0% | Dockerfile 1.0%
Discussions

Installing JDK on a new mac

I'd recommend homebrew for package management in general and sdkman for java (and related ecosystem) development tools.

More on reddit.com
🌐 r/java
17
21
December 8, 2017
MacOS - jenv local, without a ".java-version" file ?
I have the same situation and I use https://github.com/jdx/mise - multiple languages and multiple versions. Best of all, mise can understand the language-specific tool configuration file (as opposed to introducing yet another config file that the whole team needs to be watchful of when upgrading versions) More on reddit.com
🌐 r/commandline
7
3
August 14, 2024
🌐
GitHub
github.com › jenv › jenv › issues › 339
JAVA_HOME not set on apple m1 · Issue #339 · jenv/jenv
October 20, 2021 - jenv 0.5.4 I execute follow steps on my m1 MBA and intel MBP: 1. brew install jenv 2. echo eval "$(jenv init -)" >> /Users/xiquan/.zshrc 3. jenv add $(/usr/libexec/java_home) 4. jenv global 1.8 5. ...
Author   jenv
🌐
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 - You do not need to manually set JAVA_HOME in your shell configuration, as jenv will manage it automatically once the export plugin is enabled.
🌐
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 - # Take note to run below command if you are running on Apple Silicon Mac # echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc # Append jEnv init config to .zshrc echo eval "$(jenv init -)" >> ~/.zshrc # Restart ZSH session source ~/.zshrc # Alternative way to restart exec $SHELL -l ... Also, in order for jEnv to automatically set our JAVA_HOME, run the following commands to enable export plugin
🌐
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.
🌐
javathinking
javathinking.com › blog › set-java-home-to-reflect-jenv-java-version
How to Set JAVA_HOME to Reflect jenv Java Version in MacOS Bash Profile — javathinking.com
For Bash, ensure your terminal is set to open a “login shell” (Terminal > Preferences > General > “Shells open with” > “Command (complete path)” > /bin/bash -l). Alternatively, add source ~/.bash_profile to ~/.bashrc (if you use ~/.bashrc). By following these steps, you’ve configured jenv to manage Java versions and automatically update JAVA_HOME in your macOS Bash profile.
Find elsewhere
🌐
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 - $ jenv add /Library/Java/JavaVirtualMachines/jdk-15.0.1.jdk/Contents/Home/ $ jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-12.jdk/Contents/Home/ $ jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/ The exact versions depend on what you have installed. 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
🌐
Spring Framework Guru
springframework.guru › home › using jenv for setting the java_home path
Using jEnv for Setting the JAVA_HOME Path - Spring Framework Guru
May 19, 2020 - jEnv is a command line to that for Linux and OS X that makes setting the JAVA_HOME environment variable simple. Windows users can use jEnv from a Linux subsystem. To install jEnv on Linux or OS X will first clone the git repository to our home ...
🌐
MacPorts
ports.macports.org › port › jenv › details
jenv | MacPorts
for d in /Library/Java/JavaVirtualMachines/*/Contents/Home; do jenv add $d; done · 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 · Documentation · API · Issues · MacPorts ·
🌐
Bring
developer.bring.com › blog › configuring-jenv-the-right-way
Configuring jenv the right way – Bring Developer
July 27, 2018 - I had to run jenv enable-plugin export because my jenv was not able to control my JAVA_HOME. Also failing to run jenv enable-plugin maven will throw weird errors when trying to compile your project. Now.. You are all set…
🌐
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 - $ jenv global 21 $ echo $JAVA_HOME /Users/mrn/.jenv/versions/21 $ java -version openjdk version "21.0.9" 2025-10-21 OpenJDK Runtime Environment Homebrew (build 21.0.9) OpenJDK 64-Bit Server VM Homebrew (build 21.0.9, mixed mode, sharing) All without having to restart the shell! The more observant of you will notice I used the keyword global. This sets to the default version.
🌐
GitHub
gist.github.com › duydao › 9950734
java_home wrapper for Mac OS X, adding support for jenv · GitHub
java_home wrapper for Mac OS X, adding support for jenv · Raw · Readme.md · this script checks if a (global) version was set by jenv. if so, use that path if no version was requested explicitly (e.g. by java_home -v '1.7.*' or something) ...
🌐
Baeldung
baeldung.com › home › java › managing multiple jdk installations with jenv
Managing Multiple JDK Installations With jEnv | Baeldung
May 2, 2025 - Lastly, to verify the jEnv installation, we make use of the jenv doctor command. On MacOS, the command would display the following: $ jenv doctor [OK] No JAVA_HOME set [ERROR] Java binary in path is not in the jenv shims. [ERROR] Please check your path, or try using /path/to/java/home is not ...
🌐
LinuxTut
linuxtut.com › en › 87b75113da8fb2683f00
[JAVA] Install and configure jenv on macOS
January 25, 2020 - echo ${JAVA_HOME} /Users/hogehoge/.jenv/versions/11.0.2 · Setting is OK with this. rm .java-version · Required only when you want to set it globally · jenv global 11.0.2 · 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 ·
🌐
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 - You can either install it via git command or using brew on a Mac ... Once installed, we need to do some more configuration. These configurations can be added to either your Bash Profile (~/.bash_profile) OR ZSH Profile (~/.zshrc) Since I am ...
🌐
Silvae86
silvae86.github.io › 2021 › 08 › 02 › managing-java-versions-on-mac
Java versions on macOS without pain, complete guide | The caffeinated engineer
August 2, 2021 - This is what makes Maven and other tools use our default Java version until we change it using jenv. Tested on macOS Big Sur, but should work in other versions. Basically apt-get / rpm / yum / apk / <yet another Linux package manager that we need to learn because reasons>, but for Mac. And because Mac only has one distro, you only need to learn one package manager! /s. It works. Use it. It is like nvm for Java. Thank the Gods for this. Now we need to edit ~/.zshrc to automatically load and change the set JAVA_HOME for us on startup.
🌐
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 - By running mvn -version I quickly realised that maven is still using Java 9. To make maven use the Java version configured by jEnv I had to run the following: $ echo ‘JAVA_HOME=$(/usr/libexec/java_home -v $(jenv version-name))’ >> ~/.mavenrc $ source ~/.mavenrc