jenv install
brew install jenv echo "if which jenv > /dev/null; then eval "$(jenv init -)"; fi" >> ~/.zshrc source ~/.zshrc
M1 Macの場合
sudo softwareupdate --install-rosetta # M1で入れるのに必要
JDK Install
brew tap AdoptOpenJDK/openjdk brew install --cask adoptopenjdk8 brew install --cask adoptopenjdk /usr/libexec/java_home -v 1.8 /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home /usr/libexec/java_home -v 16 /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
JenvにJDKを追加
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
```
Jenvに追加されたバージョンを確認
jenv versions * system (set by /Users/keisuke.taniguchi/.jenv/version) 1.8 1.8.0.292 16.0 16.0.1 openjdk64-1.8.0.292 openjdk64-16.0.1
利用するバージョンを選択
jenv global 1.8 java -version openjdk version "1.8.0_292" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)