I'm trying to run DMelt programs (http://jwork.org/dmelt/) program using Java9 (JDK9), and it gives me errors such as:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState (file:/dmelt/jehep/lib/jython/jython.jar) to method java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of org.python.core.PySystemState
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
How can I fix it? I was trying to add –illegal-access=permit to the last line of the script "dmelt.sh" (I'm using bash in Linux), but this did not solve this problem. I'm very frustrating with this. I was using this program very often, for very long time. Maybe I should never move to JDK9
The ideal way to resolve this would be to
and asking them to fix such reflective access going forward.
From one of the threads on the mailing list :
Warning messages in any mode can be avoided, as before, by the judicious use of the
--add-exportsand--add-opensoptions.Hence a current temporary solution available is to use
--add-exportsas the VM arguments as mentioned in the docs :This would allow the
target-moduleto access all public types inpackage. In case you want to access the JDK internal classes which would still be encapsulated, you would have to allow a deep reflection using the--add-opensargument as:In your case to currently accessing the
java.io.Console, you can simply add this as a VM option -Also, note from the same thread as linked above
When
denybecomes the default mode then I expectpermitto remain supported for at least one release so that developers can continue to migrate their code. Thepermit,warn, anddebugmodes will, over time, be removed, as will the--illegal-accessoption itself.So it's better to change the implementation and follow the ideal solution to it.