Alternative to -XaddExports command-line option
Simon Nash
simon at cjnash.com
Thu Mar 24 11:05:12 UTC 2016
Dear EG members,
I would like to raise an issue with the current use of a command-line
option in the Jigsaw codebase as the only way to enable an application
to access non-exported APIs within the JDK.
Setting addExports via the command line is very problematical for some
applications. For example, I have developed an application that at
present requires access to a few internal JDK APIs. This application
needs to run on 7 different platforms and support both graphical and
console interfaces. Each platform has different packaging requirements
and launch arrangements and these would need to be substantially reworked
in order to add the -XaddExports option. In at least one case (launching
via the .jar file association on Windows), it isn't possible to add any
command-line JVM options.
Using the -XaddExports command-line option is also a problem for
application packages that need to run on Java 9 and also on earlier
versions of Java. If the launch script in the application package
specifies the -XaddExports option, the application won't run on Java 7 or
Java 8 because these versions don't understand this option.
I would like to ask the Expert Group to consider defining some alternative
means of setting addExports values in addition to the -XaddExports option.
For example, the JDK could provide a new runtime API that the application
can call if it detects that it is running on Java 9. Another option is to
support a new manifest entry in the application's executable JAR file that
would be recognized by Java 9 and ignored by previous versions of Java.
Best regards,
Simon
More information about the jpms-spec-comments
mailing list