Help us understand the problem. What is going on with this article?

Mac に brew で Oracle Java のバージョンを指定してインストールする方法

More than 3 years have passed since last update.

Mac で Java をインストールするときの問題

  • Oracle Java を手動でインストールするのが面倒くさい
  • brew cask で Java を入れると Java8 がインストールされてしまう(2014-05-02時点)

brew でバージョン違いの Java をインストール出来ないかと探してみると,homebrew-cask-versions を利用することで Java7, Java6 のインストールができました.

brew で Oracle Java のバージョンを指定してインストールする方法

# install homebrew-cask
brew tap caskroom/cask

# can treat another Java versions
brew tap caskroom/versions

# search another java version
brew cask search java
==> Exact match
java
==> Partial matches
java6  java7

# install Java7
brew cask install java7

# confirm java version
java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

JAVA_HOME の設定

/usr/libexec/java_home コマンドを利用することで,バージョンごとに JAVA_HOME の取得ができます.

JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
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
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  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
ユーザーは見つかりませんでした