Install Multiple Java Versions on macOS High Sierra
Install Homebrew Cask
On Mac, Homebrew is the de-facto package manager, and Homebrew Cask is the app manager. I’m going to use Cask to install Java 7 and 8.
Install Homebrew Cask first if you haven’t:
brew update brew tap caskroom/cask