Download instructions
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096855
Improved how to switch Java versions using BASH:
Matching Java Virtual Machines (3):
1.8.0_77, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
1.8.0_60, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
1.7.0_71, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
$ setjdk 1.8.0_77
https://github.com/StevenACoffman/dotfiles/blob/master/bin/shell/functions/java.sh
The Java version switcher scripts use java_home program.
http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096903
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096855
Find the Java Control Panel on Mac
Launch the Java Control Panel on Mac OS X (10.7.3 and above)
- Click on Apple icon on upper left of screen.
- Go to System Preferences
- Click on the Java icon to access the Java Control Panel.
How to switch Java versions using BASH:
http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/
http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/
Improved how to switch Java versions using BASH:
- Find the Java version that is required:
- /usr/libexec/java_home -V
- Run the java.sh script below:
- java.sh
- Example:
Matching Java Virtual Machines (3):
1.8.0_77, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
1.8.0_60, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
1.7.0_71, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
$ setjdk 1.8.0_77
https://github.com/StevenACoffman/dotfiles/blob/master/bin/shell/functions/java.sh
The Java version switcher scripts use java_home program.
http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096903
$ /usr/libexec/java_home --help
Usage: java_home [options...]
Returns the path to a Java home directory from the current user's settings.
Options:
[-v/--version ] Filter Java versions in the "JVMVersion" form 1.X(+ or *).
[-a/--arch ] Filter JVMs matching architecture (i386, x86_64, etc).
[-d/--datamodel ] Filter JVMs capable of -d32 or -d64
[-t/--task ] Use the JVM list for a specific task (Applets, WebStart, BundledApp, JNI, or CommandLine)
[-F/--failfast] Fail when filters return no JVMs, do not continue with default.
[ --exec ...] Execute the $JAVA_HOME/bin/ with the remaining arguments.
[-R/--request] Request installation of a Java Runtime if not installed.
[-X/--xml] Print full JVM list and additional data as XML plist.
[-V/--verbose] Print full JVM list with architectures.
[-h/--help] This usage information.
$ /usr/libexec/java_home -
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.8.0_77, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
1.8.0_60, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
1.7.0_71, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home