Using jEnv for Setting the JAVA_HOME Path

Using jEnv for Setting the JAVA_HOME Path

0 Comments

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.

Installation

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.

Configure

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.

About SFG Contributor

Staff writer account for Spring Framework Guru

    You May Also Like