Install Java 1.8 on Mac OS El Capitan

Here’s a few notes on what it took to install Java on the latest El Capitan OSX: 10.11.1.

This seems to be the best way to set this up.

  1. Install Cask:
brew update
brew install caskroom/cask/brew-cask
  1. Install jenv:
brew install jenv
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(jenv init -)"' >> ~/.zshrc
  1. Install latest Java:
brew cask install java
  1. Figure out where brew put the new Java (it’s not listed in the output!) and then run something like:
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/
  1. Then add a .java-version file containing
 1.8

That works like a .ruby-version!

1 Like