jpackage multiple --add-exports

Craig Bester cycraig33 at gmail.com
Mon May 20 19:36:16 UTC 2019


Hi!

When using the JDK13-EA jpackage utility (https://jdk.java.net/jpackage)
specifying multiple ‘--add-exports' arguments with ’--java-options' results
in the executable only passing the first ‘--add-exports' to the JVM.

For example, if the .cfg file generated by jpackage holds the following
arguments:

[JavaOptions]
--module-path=.
--add-exports=java.base/sun.security.util=AppName,ALL-UNNAMED
--add-exports=javafx.controls/com.sun.javafx.scene.control.skin=AppName,ALL-UNNAMED
--add-modules=jdk.unsupported.desktop,javafx.controls,javafx.swing

The second ‘--add-exports' will be ignored and an IllegalAccessError will be
thrown when attempting to access anything under
com.sun.javafx.scene.control.skin. The same issue occurs when using the
older javapackager too. Switching the order of the statements causes
sun.security.util calls to throw an IllegalAccessError instead.

Running the jar directly works fine: “java --module-path=.
--add-exports=java.base/sun.security.util=AppName,ALL-UNNAMED
--add-exports=javafx.controls/com.sun.javafx.scene.control.skin=AppName,ALL-UNNAMED
--add-modules=jdk.unsupported.desktop,javafx.controls,javafx.swing -jar
AppName.jar”

Is there an alternative method to specify exports when packaging a jar?
Specifying ‘Add-Exports’ in the jar manifest does not work.



--
Sent from: http://openjdk.5641.n7.nabble.com/OpenJDK-Core-Libraries-f45829.html


More information about the core-libs-dev mailing list