添加 AdoptOpenJDK/openjdk 仓库。
$ brew tap AdoptOpenJDK/openjdk
$ brew search openjdk
输出如下:
==> Formulae openjdk openjdk@11==> Casks adoptopenjdk adoptopenjdk12 adoptopenjdk14-jre adoptopenjdk-jre adoptopenjdk12-jre adoptopenjdk14-openj9 adoptopenjdk-openj9 adoptopenjdk12-openj9 adoptopenjdk14-openj9-jre adoptopenjdk-openj9-jre adoptopenjdk12-openj9-jre adoptopenjdk14-openj9-jre-large adoptopenjdk-openj9-jre-large adoptopenjdk12-openj9-jre-large adoptopenjdk14-openj9-large adoptopenjdk-openj9-large adoptopenjdk12-openj9-large adoptopenjdk8 ✔ adoptopenjdk10 adoptopenjdk13 adoptopenjdk8-jre adoptopenjdk11 adoptopenjdk13-jre adoptopenjdk8-openj9 adoptopenjdk11-jre adoptopenjdk13-openj9 adoptopenjdk8-openj9-jre adoptopenjdk11-openj9 adoptopenjdk13-openj9-jre adoptopenjdk8-openj9-jre-large adoptopenjdk11-openj9-jre adoptopenjdk13-openj9-jre-large adoptopenjdk8-openj9-large adoptopenjdk11-openj9-jre-large adoptopenjdk13-openj9-large adoptopenjdk9 adoptopenjdk11-openj9-large adoptopenjdk14
brew cask install adoptopenjdk8 brew cask install adoptopenjdk9 brew cask install adoptopenjdk10 brew cask install adoptopenjdk11 brew cask install adoptopenjdk12 brew cask install adoptopenjdk13
如果提示cask已废弃
尝试:
brew install adoptopenjdk/openjdk/adoptopenjdk11
$ /usr/libexec/java_home -V
vim ~/.bash_profile
export JAVA_HOME_8=$(/usr/libexec/java_home -v1.8) export JAVA_HOME_13=$(/usr/libexec/java_home -v13) # Java 8 export JAVA_HOME=$JAVA_HOME_8 # Java 13 # export JAVA_HOME=$JAVA_HOME_13
$ source ~/.bash_profile $ java -version openjdk version "1.8.0_252" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)
接口原型 - IT教程,计算机教程,API相关DEMO