Skip to content

Instantly share code, notes, and snippets.

@tomtheun
Created January 18, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomtheun/a17e8030d03eab671d8c2610b7602da7 to your computer and use it in GitHub Desktop.
Save tomtheun/a17e8030d03eab671d8c2610b7602da7 to your computer and use it in GitHub Desktop.
Installing Java 9
Option 1: Ops Tools
If you only need to use Java 9 with Maven, you can use our 'Ops Tools' project. This will run Maven with the desired Java version (defaults to 9, but you can switch to Java 7 or 8). Follow the instructions in the README of this project. This option has two benefits; No need install Java on you machine (it runs in a container). And you will always be using the latest version of Maven and Java update version (the bit after 'u' in '8u144' or 'minor'/'patch' version in Java 9). Beware that you will be using OpenJDK when using this option, and not Oracle JDK.
Option 2: Plain install
Go to the Oracle website (http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html), download and run installer.
Option 3: Other
* Homebrew: https://stackoverflow.com/questions/24342886/how-to-install-java-8-on-mac
* Jenv: http://www.jenv.be/
* Java version manager: https://github.com/shyiko/jabba
* Extendable version manager: https://github.com/asdf-vm/asdf
Switching between versions:
When using the Ops tools you can switch versions by exporting a variable:
```
export OPS_TOOLS_MVN_JAVA_VERSION=8
```
When using Homebrew or the plain install you can do:
```
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export JAVA_HOME=`/usr/libexec/java_home -v 9`
```
Please check the documentation for the other options.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment