cask 'java9-beta' do version '1.9,147' sha256 '9491d48d093f72b8ab3182e82b56b7dfa6ed6486ebb8df7bd189cbd34c638823' url "http://www.java.net/download/java/jdk#{version.before_comma.minor}/archive/#{version.after_comma}/binaries/jdk-#{version.before_comma.minor}-ea+#{version.after_comma}_osx-x64_bin.dmg", cookies: { 'oraclelicense' => 'accept-securebackup-cookie' } name 'Java Standard Edition Development Kit' homepage 'https://jdk9.java.net/download/' pkg 'JDK 9.pkg' postflight do system '/usr/bin/sudo', '-E', '--', '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string BundledApp', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" system '/usr/bin/sudo', '-E', '--', '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string JNI', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" system '/usr/bin/sudo', '-E', '--', '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string WebStart', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" system '/usr/bin/sudo', '-E', '--', '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string Applets', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist" system '/usr/bin/sudo', '-E', '--', '/bin/mkdir', '-p', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/bundle/Libraries" system '/usr/bin/sudo', '-E', '--', '/bin/ln', '-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/jre/lib/server/libjvm.dylib", "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/bundle/Libraries/libserver.dylib" if MacOS.version <= :mavericks system '/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--', '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' system '/usr/bin/sudo', '-E', '--', '/bin/ln', '-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents", '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' end end uninstall pkgutil: 'com.oracle.jdk-9', delete: [ MacOS.version <= :mavericks ? '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' : '', ].keep_if { |v| !v.empty? } zap delete: [ '~/Library/Application Support/Oracle/Java', '~/Library/Caches/com.oracle.java.Java-Updater', '~/Library/Caches/net.java.openjdk.cmd', ], rmdir: '~/Library/Application Support/Oracle/' caveats <<-EOS.undent This Cask makes minor modifications to the JRE to prevent any packaged application issues. If your Java application still asks for JRE installation, you might need to reboot or logout/login. The JRE packaging bug is discussed here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361 Installing this Cask means you have AGREED to the Oracle Binary Code License Agreement for Java SE at http://www.oracle.com/technetwork/java/javase/terms/license/index.html EOS end