Java launcher with --module=name[/entry-point] fails on Windows (original) (raw)

Christian Stein sormuras at gmail.com
Fri Nov 15 11:23:06 UTC 2019


Hi,

relying on the "Note: To specify an argument for a long option, you can use either --name=value or --name value." from [0] and assuming that --module is a long option (with -m being its short counterpart) I think I found an error in java.exe.

The brief history of the search is recorded at JBS [1], and yesterday, I managed to create a minimal, complete and verifiable example at [2] -- which contains a README.md file with more details. Here's a gist:

Calling java --module-path=lib --module=m/Main --help ... sometimes fails to launch the JVM. The failure, if it occurs, expresses mostly via a silent exit of the java.exe program leaving a negative value in the "DOS shell" ERRORLEVEL environment variable. Seldom, a fatal error log is written to the current working directory.

The underlying reason seems to be an error in the calculation of the application argument count and index. The later reads: AppArgIndex: -1 points to (null)

Work-around: omit the = (equals sign) after --module and the entry-point, here m/Main. This command line always gets the JVM up and running.

Cheers, Christain

[0] https://docs.oracle.com/en/java/javase/11/tools/java.html [1] https://bugs.openjdk.java.net/browse/JDK-8234076 [2] https://github.com/sormuras/JDK-8234076



More information about the jdk-dev mailing list