Skip to content

Instantly share code, notes, and snippets.

Forked from pudquick/
Last active August 29, 2015 14:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
import plistlib, os.path
# Based off of
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment