brew install jdk8 code example
Example 1: brew install jdk 8
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
Example 2: jdk 15 download brew
$ brew cask install oracle-jdk
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
$ brew cask install oracle-jdk