How to install specific Java version using Homebrew?
- Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Update homebrew if already installed:
brew update
- allow brew to lookup versions
brew tap homebrew/cask-versions
- list available java versions
brew search java
Optional: to find out the minor version of java
brew info --cask java8
- install java 8 (or any other version available)
brew install --cask java8
Raising Sean Breckenridge's comment as an answer to increase visibility:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap homebrew/cask-versions
brew cask install homebrew/cask-versions/adoptopenjdk8
There is no longer cask named "java8".