Using jEnv for Setting the JAVA_HOME Path
1 CommentLast Updated on May 19, 2020 by jt
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.
Share
You May Also Like
Consul Miniseries: Spring Boot Application and Consul Integration Part 2
By SFG Contributor Consul, Docker, Gradle, IntelliJ, Java, Lombok, Spring, Spring Boot, Spring Cloud, Spring MVC
Consul Miniseries: Spring Boot Application and Consul Integration Part 1
By SFG Contributor Consul, Docker, Gradle, Java, Lombok, Spring, Spring Boot
Daniel Hammer
What is the advantage of jEnv, over ex. SDKMAN for managing the current runtime (including JAVA_HOME)?