How to install Java 8 on Mac – Dev

The best answers to the question “How to install Java 8 on Mac” in the category Dev.


Editors note: This question was asked in 2014, and the answers may be outdated.

I want to do some programming with the latest JavaFX, which requires Java 8. I’m using IntelliJ 13 CE and Mac OS X 9 Mavericks. I ran Oracle’s Java 8 installer, and the files look like they ended up at


but previous versions are at


Not sure why the latest installer puts this in /Library instead of /System/Library (nor what the difference is). But /usr/libexec/java_home doesn’t find 1.8, so all the posts I’ve found on how to set your current java version don’t work. I’ve tried adding a symbolic link to make it look like 1.8 is in the /System/Library... path, but it doesn’t help. /usr/libexec/java_home -V still only lists the old Java 1.6.

Ironically, the “Java” control panel under System Preferences shows only Java 1.8!

Why doesn’t Oracle’s installer put it where it really goes? And how can I work around this problem?


Note: Oracle Java 8/9/10 is no longer available for public download (license change).

First install and update brew from Terminal:

/usr/bin/ruby -e "$(curl -fsSL"

brew tap homebrew/cask-versions

brew update

NEW as of June 2019

To install the JDKs from AdoptOpenJDK:

brew tap adoptopenjdk/openjdk

brew install --cask adoptopenjdk8
brew install --cask adoptopenjdk9
brew install --cask adoptopenjdk10
brew install --cask adoptopenjdk11


Java 8:

brew install --cask java8

Java Latest:

brew install --cask java


Oracle has a poor record for making it easy to install and configure Java, but using Homebrew, the latest OpenJDK (Java 14) can be installed with:

brew install --cask adoptopenjdk8

For the many use cases depending on an older version (commonly Java 8), the AdoptOpenJDK project makes it possible with an extra step.

brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk8

Existing users of Homebrew may encounter Error: Cask adoptopenjdk8 exists in multiple taps due to prior workarounds with different instructions. This can be solved by fully specifying the location with brew install --cask adoptopenjdk/openjdk/adoptopenjdk8.


I just did this on my MBP, and had to use

$ brew tap homebrew/cask-versions
$ brew cask install java8

in order to get java8 to install.


Java8 is no longer available on homebrew, brew install java8 will not work.

Instead, use:

brew cask install adoptopenjdk/openjdk/adoptopenjdk8

See this commit for technical details.

Please note as well you may see issues around Cask adoptopenjdk8 exists in multiple taps. This is a known issue, currently being worked on, which you can see here:

For those who don’t want to run through the details, here is a summary:

# To install JDK8
brew cask install adoptopenjdk/openjdk/adoptopenjdk8

# To be able to safely run 'brew cleanup'
brew untap adoptopenjdk/openjdk
brew untap caskroom/versions
brew cleanup