Help us understand the problem. What are the problem?

posted at

updated at

Java 11 (OpenJDK: AdoptOpenJDK) を Homebrew で macOS にインストールする


  • macOS Big Sur 11.4


GitHub - AdoptOpenJDK/homebrew-openjdk: AdoptOpenJDK HomeBrew Tap

$ brew tap AdoptOpenJDK/openjdk
$ brew install --cask adoptopenjdk11

(以前は brew cask install adoptopenjdk11 というコマンドだった)

java_home コマンドでインストールされたディレクトリの場所を確認

$ /usr/libexec/java_home -v 11

環境変数 JAVA_HOME と PATH を設定

必要に応じて .bash_profile や .bashrc などに記述する。

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

インストールされた AdoptOpenJDK を確認

$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

$ javac -version
javac 11.0.11

$ which java

$ which javac

$ ls /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/
jaotc       javap       jfr     jmap        jstat       rmiregistry
jar     jcmd        jhsdb       jmod        jstatd      serialver
jarsigner   jconsole    jimage      jps     keytool     unpack200
java        jdb     jinfo       jrunscript  pack200
javac       jdeprscan   jjs     jshell      rmic
javadoc     jdeps       jlink       jstack      rmid
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Help us understand the problem. What are the problem?