最佳答案
Java 9 (jdk-9+170) does not allow by default an application to see all classes from the JDK, unlike all previous versions of Java, due to the new module system.
To workaround this, the java
command line offers a new argument --add-exports
which allows to break encapsulation as follows:
java -jar josm.jar --add-exports java.base/sun.security.util=ALL-UNNAMED --add-exports java.base/sun.security.x509=ALL-UNNAMED
This is well explained in JEP 261.
I have read about a similar option --add-opens
using the same syntax, but the JEP 261 has not yet been updated to describe it (last update: 2017/03/08 13:58).
What is the difference between these two options?
EDIT: The JEP 261 has been updated on 2017-09-22 to explain it.