SET JAVA_HOME to reflect jenv java version

bash, java-home, jenv

Solution

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)

Problem

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 changes accordingly. How do i do that? I have following on my `~/.bash_profile` ``` if which jenv > /dev/null; then eval "$(jenv init -)"; fi ```

Original source