19
18

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 5 years have passed since last update.

JDKのバージョンの切替、確認、インストール(Mac OS X)

19
Last updated at Posted at 2015-05-22

最新のJDKのインストール

Homebrew-caskでインストールしていきます。

まずはbrewのupdateから

$ brew update

Homebrew-caskのJDKバージョンを確認

$ brew cask info java

java: 1.8.0_45
Java, Java Standard Edition Development Kit
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Not installed
https://github.com/caskroom/homebrew-cask/blob/master/Casks/java.rb
==> Contents
  JDK 8 Update 45.pkg (pkg)
==> Caveats
This Cask makes minor modifications to the JRE to prevent issues with
packaged applications, as discussed here:

  https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361

If your Java application still asks for JRE installation, you might need
to reboot or logout/login.

Installing this Cask means you have AGREED to the Oracle Binary Code
License Agreement for Java SE at

  http://www.oracle.com/technetwork/java/javase/terms/license/index.html

Homebrew-caskでインストール

$ brew cask install java

JDKのバージョンの切替

$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_45`

JDKのバージョンの確認

$ java -version

java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

インストールされているJDKのバージョンを確認

$ /usr/libexec/java_home -V

Matching Java Virtual Machines (4):
    1.8.0_45, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
    1.7.0_75, x86_64:	"Java SE 7"	/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
    1.6.0_65-b14-462, x86_64:	"Java SE 6"	/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-462, i386:	"Java SE 6"	/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
19
18
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
19
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?