43
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-01-17

今回の環境

  • 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
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

環境変数 JAVA_HOME と PATH を設定

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

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
PATH=${JAVA_HOME}/bin:${PATH}

インストールされた 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
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java

$ which javac
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/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
43
33
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
43
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?