Using jEnv for Setting the JAVA_HOME Path1 Comment
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 directory using this command:
$ git clone https://github.com/gcuisinier/jenv.git ~/.jenv
On Mac OS X you can also install using Homebrew with this command:
$ brew install jenv
The next step is to configure your bash profile. To do this enter the following commands:
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(jenv init -)"' >> ~/.bash_profile
If your using Zsh just change .bash_profile above to .zshrc and everything should work. You may need to logout and log back in to load changes.
Now we can use jEnv to add different versions of Java by using the following command:
$ jenv add /path/to/java/version
You can learn more about jEnv here.
What is the advantage of jEnv, over ex. SDKMAN for managing the current runtime (including JAVA_HOME)?