Modifying Oracle’s Java SDK to run Java applications on OS X
As part of releasing the developer betas for OS X 10.11, Apple announced that El Capitan would be the end of the line for the Java 6 runtime and tools provided by Apple, with the clear statement that developers should be moving on to Oracle’s Java tools.
To completely replace Apple’s Java 6 tools, Oracle’s Java JDK (Java SE Development Kit) will need to be installed. This is because the Oracle Java JRE (Java Runtime Environment) on OS X is a browser plug-in for running Java via a web browser and does not include capabilities for running Java desktop apps or command line tools.
By default though, the Oracle JDK does not set several options to advertise the capabilities provided by the JDK to Java apps, which may cause applications that need those capabilities to fail to launch. The capabilities are actually present in the JDK, but those options need to be set before applications will recognize them as available.
To fix this, we need to add the following options to Oracle’s Java JDK:
In turn, enabling these options means they need to be added to the list of JVMCapabilities stored in the following plist file:
For more details, see below the jump.
Michael Lynn has developed a Python script for adding the necessary BundledApp and JNI options to the Info.plist file referenced above.
Update – 8-11-2015: Mike has updated his script to provide better compatibility for OS X Java applications to be run via Oracle’s Java JDK. He’s posted a blog entry with the details here:
He was kind enough to update the Github gist linked to this post, so the script displayed below is the updated version. I’ve also updated the script and payload-free package available from my Github repo.
When this script is run, it will update all of the Java JDKs stored in /Library/Java/JavaVirtualMachines with the required options.
Once the BundledApp and JNI options are added, Java applications should be able to start using the JDK’s capabilities in order to launch and run. In my own case, I verified this by running ImageJ, an open-source Java-based image processing program, on a machine where Oracle’s Java 1.8.0_51 (also known as Java 8 Update 51) JDK has been installed and updated with the BundledApp and JNI options referenced above.
I’ve posted Michael’s script to my GitHub repo at the following address:
This script is also available as a payload-free installer package, stored as a .zip file in the payload_free_installer directory.