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 OverflowGitHub
github.com › jenv › jenv
GitHub - jenv/jenv: Manage your Java environment · GitHub
Where multiple versions are set, the highest priority setting as above takes effect. For example if the global 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%
Jenv
jenv.be
jEnv - Manage your Java environment
$ jenv versions system oracle64-1.6.0.39 * oracle64-1.7.0.11 (set by /Users/hikage/.jenv/version)
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 the current shell and ensures that tools like maven work properly · 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 scripting: ---PowerShell: $ENV:JENVUSE="jdk17" ---CMD/BATCH: set "JENVUSE=jdk17"
Starred by 916 users
Forked by 106 users
Languages PowerShell 97.1% | Batchfile 2.9%
Bring
developer.bring.com › blog › configuring-jenv-the-right-way
Configuring jenv the right way – Bring Developer
July 27, 2018 - Type jenv versions on terminal. You would see something similar to this.. system (set by /Users/sujithsreekumar/.jenv/version) - 1.8 - 1.8.0.92 - 10.0 - 10.0.1 - 9.0 - 9.0.1 - oracle64-1.8.0.92 - oracle64-10.0.1 - oracle64-9.0.1
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.
Stack Overflow
stackoverflow.com › questions › 73317805 › changing-java-version-using-jenv-in-a-shell-script
react native - Changing Java version using jenv in a shell script - Stack Overflow
jenv local 1.8; java -version; # Some code here involving sdkmanager...
Top answer 1 of 4
135
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)
2 of 4
15
For me, enabling the export plugin like kimbaudi didn't work. Adding the following code to .bash_profile (or .bashrc, .zprofile or .zshrc depending on what shell you use) did the job for me:
Copyif which jenv > /dev/null; then eval "$(jenv init -)"; fi
This was in the troubleshooting page, but they seemed to state it was in the instructions guide, which it wasn't.
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 ... projects or 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 use....
Reflectoring
reflectoring.io › manage-jdks-with-jenv
Managing Multiple JDK Installations With jEnv
October 18, 2022 - To use the new JDK with jEnv, we need to tell jEnv where to find it. Let’s check first which versions of the JDK jEnv already knows about with the command jenv versions: * system (set by /home/tom/.jenv/version) 11 11.0 11.0.8 13 13.0 13.0.2 14 14.0 14.0.2 openjdk64-11.0.8 openjdk64-13.0.2 openjdk64-14.0.2
They
they.es › posts › jenv-easily-manage-multiple-java-versions
JEnv - Easily Manage Multiple Java Versions
March 23, 2021 - As you can see, the system wide version of Java can be set in a file ~/.jenv/version.
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