1
1

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 1 year has passed since last update.

Java 17 (OpenJDK: Eclipse Temurin) を Homebrew で macOS にインストールする

Posted at

概要

  • Java 17 (Eclipse Temurin 17) を Homebrew で macOS にインストールする。

今回の環境

  • macOS Big Sur 11.6

インストール

インストール方法は Eclipse Temurin の前身である AdoptOpenJDK の公式資料が参考になる。

GitHub - AdoptOpenJDK/homebrew-openjdk: AdoptOpenJDK HomeBrew Tap

$ brew tap homebrew/cask-versions
$ brew install --cask temurin17

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

$ /usr/libexec/java_home -v 17
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home

環境変数 JAVA_HOME と PATH を設定

環境変数 JAVA_HOME と PATH を設定する。

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

これらは必要に応じて .zprofile や .zshrc などにも記述する。

インストールした Eclipse Temurin を確認

$ java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
$ javac --version
javac 17.0.2
$ which java
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java
$ which javac
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/javac
$ ls /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin 
jar             javap           jdeps           jlink           jrunscript      keytool
jarsigner       jcmd            jfr             jmap            jshell          rmiregistry
java            jconsole        jhsdb           jmod            jstack          serialver
javac           jdb             jimage          jpackage        jstat
javadoc         jdeprscan       jinfo           jps             jstatd

参考資料

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?