Installing JDK9 on Max OSX
Java 9 is almost ready for GA release. If you haven’t yet got the JDK9 installed and playing with it, I suggest you do it right now and check out some awesome features of Java 9.
Below we will see two ways to install JDK9 on Mac OSX (Sierra 10.12.5).
Feeling Lazy to build yourself a JDK?
If you don’t want to get out of couch and feeling lazy then easiest way to install JDK9 is to go to OpenJDK EA Build and download the build specific to your OS. Fox Mac OSX, download the .dmg package and install it.
Once installation completes, run below command to list all installed JDks.
Your output should look like below -
Matching Java Virtual Machines (5): 9, x86_64: "Java SE 9" /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home 1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home 1.8.0_73, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_73.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_79, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Boom! We have the JDK 9 installed now. You can set your JAVA_HOME to point to JDK9 installation directory and start using the JDK.
Adventurous mode on for building JDK?
OpenJDK source code is available online and you can easily download it and build the JDK for yourself.
Mihail Stoynkov have documented steps on this blog. It will be fun to build JDK, So go ahead!
Assuming you have built jdk9 in
~/jdk9 directory, your built jdk should be at path
Run below commands in terminal.
cd ~/jdk9/build/macosx-x86_64-normal-server-release/jdk/bin ./java -version
This should print java version similar to below -
openjdk version "9-internal" OpenJDK Runtime Environment (build 9-internal+0-adhoc.manik.jdk9) OpenJDK 64-Bit Server VM (build 9-internal+0-adhoc.manik.jdk9, mixed mode)