From 0ce7b8b05611de0179b551dc0a8f8b6ae1cdf443 Mon Sep 17 00:00:00 2001 From: Bradley Hess Date: Wed, 18 Nov 2015 00:28:18 -0500 Subject: [PATCH] Add java(8)-beta and java9-beta Inspired by #1082 --- Casks/java-beta.rb | 63 +++++++++++++++++++++++++++++++++++++++++++++ Casks/java9-beta.rb | 63 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 Casks/java-beta.rb create mode 100644 Casks/java9-beta.rb diff --git a/Casks/java-beta.rb b/Casks/java-beta.rb new file mode 100644 index 000000000..d0ce6dfb2 --- /dev/null +++ b/Casks/java-beta.rb @@ -0,0 +1,63 @@ +cask :v1 => 'java-beta' do + version '1.8.0_72-b05' + sha256 'e507e19e4300a5478a9c50eec2db50e4e69a9106fca19a15fcb42287bd6131a9' + + url 'http://download.java.net/jdk8u72/archive/b05/binaries/jdk-8u72-ea-bin-b05-macosx-x86_64-26_oct_2015.dmg', + :cookies => { 'oraclelicense' => 'accept-securebackup-cookie' } + name 'Java' + name 'Java Standard Edition Development Kit' + homepage 'https://jdk8.java.net/download.html' + license :gratis + + pkg 'JDK 8 Update 72.pkg' + postflight do + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string BundledApp', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string JNI', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string WebStart', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string Applets', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/bin/mkdir', '-p', '--', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Home/bundle/Libraries" + system '/usr/bin/sudo', '-E', '--', + '/bin/ln', '-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Home/jre/lib/server/libjvm.dylib", "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Home/bundle/Libraries/libserver.dylib" + if MacOS.release <= :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}.jdk/Contents", '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' + end + end + + uninstall :pkgutil => 'com.oracle.jdk8u72', + :delete => [ + MacOS.release <= :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 diff --git a/Casks/java9-beta.rb b/Casks/java9-beta.rb new file mode 100644 index 000000000..f2d79f359 --- /dev/null +++ b/Casks/java9-beta.rb @@ -0,0 +1,63 @@ +cask :v1 => 'java9-beta' do + version '1.9-ea-b92' + sha256 '95d9ab6deec34872789d0d755a1bc16ec50374144cbf7bc60b75f1a2a0131e3c' + + url 'http://download.java.net/jdk9/archive/b92/binaries/jdk-9-ea-bin-b92-macosx-x86_64-11_nov_2015.dmg', + :cookies => { 'oraclelicense' => 'accept-securebackup-cookie' } + name 'Java' + name 'Java Standard Edition Development Kit' + homepage 'https://jdk9.java.net/download/' + license :gratis + + 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}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string JNI', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string WebStart', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/usr/libexec/PlistBuddy', '-c', 'Add :JavaVM:JVMCapabilities: string Applets', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Info.plist" + system '/usr/bin/sudo', '-E', '--', + '/bin/mkdir', '-p', '--', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Home/bundle/Libraries" + system '/usr/bin/sudo', '-E', '--', + '/bin/ln', '-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Home/jre/lib/server/libjvm.dylib", "/Library/Java/JavaVirtualMachines/jdk#{version}.jdk/Contents/Home/bundle/Libraries/libserver.dylib" + if MacOS.release <= :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}.jdk/Contents", '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK' + end + end + + uninstall :pkgutil => 'com.oracle.jdk9', + :delete => [ + MacOS.release <= :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