JDK-8264730 : Document java-options limitations
  • Type: Bug
  • Component: docs
  • Affected Version: 16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-04-05
  • Updated: 2021-06-28
  • Resolved: 2021-06-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17Fixed
Related Reports
Relates :  
Description
The "--java-options" jpackage option can be used to send any argument to the jli launcher, but some options conflict with the options automatically generated by jpackage.
The intent of this enhancement is to document those (possibly) conflicting options:
--module (or -m)
--module-path (or -p_
--class-path (or -classpath, or -cp, or -Djava.classpath=...)
-jar

Comments
something resembling the above should be added to Packaging Tool User's Guide, possibly in Section 3 under "Set JVM Options"
22-04-2021

jpackage adds several arguments to jli java invocation, before those provided by the --java-options option. - For a class-path application: Jpackage adds a default "-Djava.class.path=<path to each jar in input dir>" option. If the --java-options value contains "-cp", "-classpath", or "-Djava.class.path" it will override this default , so you may need to include the default in your --java-options. for example, only one jar, "foo.jar" in input dir, but you also want to include classes from "classes" subdir, use "-cp \$APPDIR/foo.jar:\$APPDIR/classes" - For a modular application Jpacakge will add a default --module-path $APPDIR\mods (which is where it will have put the app mods if not built into the runtime). If you include a --module-path option in your --java-options option value, it will come after the default value, unlike classpath where one overrides the other, the composite module path is used, with the path you specify in --java-options searched first.
22-04-2021