Skip to content

Instantly share code, notes, and snippets.

@mochadwi
Last active October 26, 2016 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mochadwi/938d78da935b94f342907e5626c46f85 to your computer and use it in GitHub Desktop.
Save mochadwi/938d78da935b94f342907e5626c46f85 to your computer and use it in GitHub Desktop.
How to install jenv-your java environtment manager

What's jEnv ?

jEnv is a command line tool to help you forget how to set the JAVA_HOME environment variable

Installation (OS)

Linux / OS X

$ git clone https://github.com/gcuisinier/jenv.git ~/.jenv

Mac OS X via Homebrew

$ brew install jenv

Installation (Shell)

Bash

$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile

$ echo 'eval "$(jenv init -)"' >> ~/.bash_profile

Zsh

$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(jenv init -)"' >> ~/.zshrc

Configure

$ jenv add /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  oracle64-1.6.0.39 added
$ jenv add /Library/Java/JavaVirtualMachines/jdk17011.jdk/Contents/Home
  oracle64-1.7.0.11 added

And Use !

List managed JDKs

$ jenv versions
  system
  oracle64-1.6.0.39
* oracle64-1.7.0.11 (set by /Users/hikage/.jenv/version)

Configure global version

$ jenv global oracle64-1.6.0.39

Configure local version (per directory)

$ jenv local oracle64-1.6.0.39

Configure shell instance version

$ jenv shell oracle64-1.6.0.39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment