https://github.com/Homebrew/homebrew-cask-versions
$ brew tap homebrew/cask-versions
$ brew cask install java
$ brew cask install java11
$ brew cask install java8
$ brew cask install adoptopenjdk8
$ brew cask install corretto8
$ /usr/libexec/java_home -V
$ /usr/libexec/java_home -v 版本号
$ export JAVA_HOME=`/usr/libexec/java_home -v "14"`
$ PATH=${JAVA_HOME}/bin:${PATH}
$ export JAVA_HOME=`/usr/libexec/java_home -v "11"`
$ PATH=${JAVA_HOME}/bin:${PATH}
$ export JAVA_HOME=`/usr/libexec/java_home -v "1.8"`
$ PATH=${JAVA_HOME}/bin:${PATH}
$ brew install jenv
# Shell: bash
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(jenv init -)"' >> ~/.bash_profile
# Shell: zsh
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(jenv init -)"' >> ~/.zshrc
$ cd ~
$ mkdir ~/.jenv/versions
$ jenv add `/usr/libexec/java_home -v "1.8"`
$ jenv versions
* system (set by /Users/[ユーザ名]/.jenv/version)
1.8
1.8.0.222
openjdk64-1.8.0.222
$ jenv global 1.8.0.222
$ jenv versions
system
1.8
* 1.8.0.222 (set by /Users/[ユーザ名]/.jenv/version)
openjdk64-1.8.0.222
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode)
$ jenv local 11.0
$ jenv versions ✘
system
1.8
1.8.0.222
* 11.0 (set by /Users/[jenv localを実行したディレクトリ]/.java-version)
11.0.2
openjdk64-1.8.0.222
openjdk64-11.0.2
$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
$ cat .java-version
11.0
$ jenv enable-plugin export