SET JAVA_HOME to reflect jenv java version

I just started using jenv , I followed a blog post that explained how to use jenv and configure several java versions on MacOSX. But the problem I ran into is setting up JAVA_HOME. When I switch the java environment using jenv , I want to make sure that the JAVA_HOME in my bash_profile also changes accordingly.

How can I do it?

I have the following mine ~/.bash_profile

 if which jenv > /dev/null; then eval "$(jenv init -)"; fi 
+5
source share
2 answers

Try the plugin "export":

jenv enable-plugin export

You can check the "Export plugins" section in Readme.md in the jEnv Github repository ( https://github.com/gcuisinier/jenv )

+13
source

please see if the following link helps.

https://github.com/gcuisinier/jenv/issues/44

+1
source

Source: https://habr.com/ru/post/1213756/


All Articles