Skip to content

Instantly share code, notes, and snippets.

@headius
Last active October 9, 2018 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/88ef499ffbf9ed86e6f74713ac0fafac to your computer and use it in GitHub Desktop.
Save headius/88ef499ffbf9ed86e6f74713ac0fafac to your computer and use it in GitHub Desktop.
Using module path silences errors?
[--dev] ~/projects/jruby $ java -classpath lib/jruby.jar org.jruby.Main -e 'puts "hello"'
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.util.SecurityHelper (file:/Users/headius/projects/jruby/lib/jruby.jar) to field java.lang.reflect.Field.modifiers
WARNING: Please consider reporting this to the maintainers of org.jruby.util.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
hello
[--dev] ~/projects/jruby $ java --module-path lib/jruby.jar org.jruby.Main -e 'puts "hello"'
hello
[--dev] ~/projects/jruby $ java -Dsun.reflect.debugModuleAccessChecks=1 --module-path lib/jruby.jar org.jruby.Main -e 'puts "hello"'
java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.lang.reflect.Field.modifiers accessible: module java.base does not "opens java.lang.reflect" to module org.jruby
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:170)
at org.jruby/org.jruby.util.SecurityHelper.setNonRestrictedJava8(SecurityHelper.java:56)
at org.jruby/org.jruby.util.SecurityHelper.checkCryptoRestrictions(SecurityHelper.java:26)
at org.jruby/org.jruby.Ruby.init(Ruby.java:1254)
at org.jruby/org.jruby.Ruby.newInstance(Ruby.java:362)
at org.jruby/org.jruby.Main.internalRun(Main.java:273)
at org.jruby/org.jruby.Main.run(Main.java:234)
at org.jruby/org.jruby.Main.main(Main.java:206)
hello
[] ~/projects/jruby $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment