-XaddExports: not recognized in JavaVMInitArgs on Windows
Mandy Chung
mandy.chung at oracle.com
Thu Mar 3 23:55:13 UTC 2016
> On Mar 3, 2016, at 2:49 PM, Keimpe Bronkhorst <keimpe.bronkhorst at oracle.com> wrote:
>
> I'm using build 9-ea+107-jigsaw-nightly-h4560-20160301 on Windows.
>
> I'm executing my program through jvm.dll using JavaVMInitArgs and JNI. I set JavaVMInitArgs.ignoreUnrecognized = JNI_FALSE and add -XaddExports:java.desktop/sun.awt=ALL-UNNAMED as one of the JavaVMInitArgs.options.
>
> This results in Unrecognized option: -XaddExports:java.desktop/sun.awt=ALL-UNNAMED
>
In the current implementation, -XaddExports is a launcher option, not a VM option. For custom launchers, it’s yet to decide whether the equivalent of -XaddExports.
For now, you can pass -Djdk.launcher.addexports.<N>=<module>/<package>=<target>
$N is a unique number starting from 0, one system property per <module>/<package>. For example
-Djdk.launcher.addexports.0=java.desktop/sun.awt=ALL-UNNAMED
> If use JavaVMInitArgs.ignoreUnrecognized = JNI_TRUE, I run into the exception:
> Exception breakpoint: Reflection.java:467, java.lang.IllegalAccessException, class org.openide.util.RequestProcessor$TopLevelThreadGroup cannot access class sun.awt.AppContext (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @204f30ec
>
> Is this a known limitation at this time or should I file a bug?
It’s a known open issue (I couldn’t find from JBS yet and will file one).
Mandy
More information about the jigsaw-dev
mailing list