was successfully added to your cart.

Install Java 1.8 on Mac OS El Capitan

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

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

Install Cask7:

brew update
brew install caskroom/cask/brew-cask

Install jenv:

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

Install latest Java:

brew cask install java

The next is figure out where is the new JDK installed location, normally in the /Library/Java/JavaVirtualMachines/jdk******/Contents/Home/. The JDK version might be different.

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

When you execute the jenv add command, might return an error message shows:

ln: /Users/XXX/.jenv/versions/oracle64- No such file or directory

Then we just create the missing folder as the location above:

mkdir /Users/XXX/.jenv/versions/oracle64-

Check the new Java version:

java -version

That works.