Created
December 10, 2015 19:16
-
-
Save Ch4s3/cf45dd8e5b2e65e6cbdd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if RUBY_PLATFORM == "java" # Allows the application to work with other Rubies if not JRuby | |
require "java" | |
java_import "java.lang.ClassNotFoundException" | |
begin | |
security_class = java.lang.Class.for_name("javax.crypto.JceSecurity") | |
restricted_field = security_class.get_declared_field("isRestricted") | |
restricted_field.accessible = true | |
restricted_field.set nil, false | |
rescue ClassNotFoundException => e | |
# Handle Mac Java, etc not having this configuration setting | |
$stderr.print "Java told me: #{e}n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment