install java via brew code example
Example 1: install java runtime mac brew
$ brew cask install java
Example 2: brew install jdk 8
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
$ brew cask install java
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8