Skip to content

Instantly share code, notes, and snippets.

@branneman branneman/
Last active Oct 1, 2017

What would you like to do?
macOS: Manage Multiple versions of Java

macOS: Manage Multiple versions of Java

Setup tooling

brew update
brew install jenv
brew tap caskroom/cask
brew tap caskroom/versions
mkdir ~/.jenv/versions

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

Restart your terminal when you're done.

Install Java versions

Download & Install all the different Java versions you like, then print all found Java versions:

/usr/libexec/java_home -V

Add them to jenv:

jenv add /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

Print all installed versions

jenv versions

Switch version

jenv global oracle64-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.