Oracle Java JDK, OpenJDK, Java 11 and macOS

With Java 8 approaching the end of its lifecycle, Oracle has made some changes to the Oracle JDK license that will affect Java 11’s JDK. As of Oracle Java JDK 8, you can use the JDK for free in the following circumstances:

Development

Testing

Prototyping

Production

As of Oracle Java JDK 11, you can use the JDK for free in the following circumstances:

Development

Testing

Prototyping

Notice that Production has dropped off the list? If you use Oracle Java JDK 11 for production use, Oracle is now expecting payment. For the complete details, please see the license agreement (relevant sections highlighted below):

If you don’t want to or can’t pay Oracle, what are the available options?

An important difference between Oracle JDK 11 and OpenJDK 11 for Mac admins is the following:

Oracle JDK: Oracle will provide an installer package for macOS

OpenJDK: Oracle does not provide an installer for macOS at this time.

OpenJDK builds for macOS are currently available as zip and tar.gz files. The JDK files need to be uncompressed and moved into the following location on macOS:

/Library/Java/JavaVirtualMachines

Once uncompressed into /Library/Java/JavaVirtualMachines, the JDK build should be stored in a directory named for the specific OpenJDK version. The directory and all enclosed files need to have the following permissions set:

macOS should automatically pick up the new Java version once added to /Library/Java/JavaVirtualMachines.

To display information about it, run the following command:

java -version

To help address the current lack of an installer package for OpenJDK 11, I’ve written several AutoPkg recipes:

The .pkg recipe will create an installer package which does the following:

Removes any existing OpenJDK 11 builds from /Library/Java/JavaVirtualMachines using a preinstall script

Installs the latest OpenJDK 11 build with the correct permissions into /Library/Java/JavaVirtualMachines