Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Esko Pilot and Esko Shuttle Using Oracle JDK 8r51 no longer needs Apple's Java 6
import plistlib, os.path, os
# Based off of
# and
def jdk_info_plists():
# Find all the JDK Info.plist files
JDK_ROOT = "/Library/Java/JavaVirtualMachines"
if (os.path.exists(JDK_ROOT) and os.path.isdir(JDK_ROOT)):
# It's present, let's look for installs
for file in os.listdir(JDK_ROOT):
jdk_dir = os.path.join(JDK_ROOT, file)
if (os.path.isdir(jdk_dir)):
# Check for Info.plist
info_plist = os.path.join(jdk_dir, "Contents", "Info.plist")
if (os.path.isfile(info_plist)):
yield info_plist
for info_plist in jdk_info_plists():
# Change all the plists of all the installed JDKs
info = plistlib.readPlist(info_plist)
# Convert the capabilities into a set
capabilities = set(info['JavaVM']['JVMCapabilities'])
# Update our changes
info['JavaVM']['JVMCapabilities'] = sorted(capabilities)
# Write back our changes
plistlib.writePlist(info, info_plist)
# Create a symlink to fix legacy applications
# Find the Contents directory
contents_path = os.path.dirname(info_plist)
# make the bundle/Libraries subpath
bundle_libraries = os.path.join(contents_path, "Home", "bundle", "Libraries")
# Just in case you run this script multiple times, we'll fail if the directory already exists
# create the symlink between libjvm.dylib and libserver.dylib
libjvm_dylib = os.path.join(contents_path, "Home", "jre", "lib", "server", "libjvm.dylib")
libserver_dylib = os.path.join(bundle_libraries, "libserver.dylib")
# Just in case you run this script multiple times, we'll fail if the file already exists
os.symlink(libjvm_dylib, libserver_dylib)

This comment has been minimized.

Copy link
Owner Author

@dderusha dderusha commented Aug 14, 2015

Tested on Oracles JDK 840 - 851. OSX 10.9 - 10.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment