50
40

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.

homebrew-caskでJava8をインストールする

Last updated at Posted at 2019-04-22

homebrew-caskについては以下記事を読んでセットアップしてください。

MacのBrewで複数バージョンのJavaを利用する - Qiita

この手順通りに brew cask install java8 するとエラーが出ます。

$ brew cask install java8
Error: Cask 'java8' is unavailable: No Cask with this name exists.

Java有償化問題とJava8のサポート終了の影響で、java8が消えてなくなっています。

Oracle has deleted their Java 8 builds from their public website. There’s no way for Homebrew to download them for you any longer. If you want Oracle’s Java 8, you’re going to have to log into Oracle’s website with your personal Oracle account, and download and install it manually.
Delete java8.rb · Homebrew/homebrew-cask-versions@2f7c1d5

代わりに adoptopenjdk8 がリリースされていますので、それをインストールすることでJava8を使うことができます。

$ brew tap AdoptOpenJDK/openjdk
$ brew cask install adoptopenjdk8

切り替えはjava8のときと同様で問題なさそうです。

$ export JAVA_HOME=`/usr/libexec/java_home -v "1.8"`
$ PATH=${JAVA_HOME}/bin:${PATH}
50
40
2

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
50
40

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?