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?
1. Keep using Oracle Java JDK 8
Oracle will continue to provide updates for Java 8 until January 2019, so a short-term solution is to keep using JDK 8 until support ends. This is only a short term solution however. If you want to continue using Java 8 past January 2019, you may need to start paying Oracle in order to get access to continuing Java 8 support.
2. Migrate from Oracle Java JDK to OpenJDK
In addition to its commercial offering, Oracle has an open-source Java available named OpenJDK. As of Java 11, Oracle will be providing functionally identical JDK builds to both the commercially licensed Oracle JDK and the open-source OpenJDK. For more details, please see below the jump:
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
The preinstall script used is available below: