3
1

More than 1 year has passed since last update.

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

Posted at

概要

  • AdoptOpenJDK の後継である Eclipse Temurin を Homebrew で macOS にインストールする。

Good-bye AdoptOpenJDK. Hello Adoptium! | AdoptOpenJDK Blog

The move from AdoptOpenJDK to Eclipse Adoptium is now complete. The same great community that brought you high quality Java binaries for the last four years at AdoptOpenJDK is now fully productive at Adoptium.

Adoptium Celebrates First Release | Adoptium Blog

This first release of Temurin from the Adoptium community and covers the latest versions of Java SE 8, Java SE 11, and Java SE 16 on each of Linux, Windows, and macOS on Intel 64-bit processors, with more platforms to follow shortly.

今回の環境

  • macOS Big Sur 11.5

インストール

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

GitHub - AdoptOpenJDK/homebrew-openjdk: AdoptOpenJDK HomeBrew Tap

brew tap で参照先に cask-versions を追加。
brew install で Eclipse Temurin 8 をインストールする。

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

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

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

環境変数 JAVA_HOME と PATH を設定

必要に応じて .zprofile や .zshrc などに記述する。

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

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

$ java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (Temurin)(build 25.302-b08, mixed mode)

$ javac -version
javac 1.8.0_302

$ which java
/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin/java

$ which javac
/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin/javac

$ ls /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin
appletviewer    javac           jfr             jstack          rmic            wsgen
clhsdb          javadoc         jhat            jstat           rmid            wsimport
extcheck        javah           jinfo           jstatd          rmiregistry     xjc
hsdb            javap           jjs             keytool         schemagen
idlj            jcmd            jmap            native2ascii    serialver
jar             jconsole        jps             orbd            servertool
jarsigner       jdb             jrunscript      pack200         tnameserv
java            jdeps           jsadebugd       policytool      unpack200

参考資料

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