forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
java.rb
43 lines (37 loc) · 2.24 KB
/
java.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Java < Cask
url 'http://download.oracle.com/otn-pub/java/jdk/8-b132/jdk-8-macosx-x64.dmg',
:cookies => {
'oraclelicense' => 'accept-securebackup-cookie'
}
homepage 'http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html'
version '1.8.0'
sha256 '60db4220632adb017cd8315a7a0bf0002a2ee49008c651ffc67ef38eafa46717'
install 'JDK 8.pkg'
after_install 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/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
uninstall :pkgutil => [ 'com.oracle.jdk8', 'com.oracle.jre' ],
:files => '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK'
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