Intended usage of `java --dry-run`?

Alan Bateman Alan.Bateman at
Thu Apr 13 07:59:20 UTC 2017

On 13/04/2017 08:20, Peter Levart wrote:

> ...and in addition, that the main class is not even initialized - no 
> user code is executed, right? I think this excludes any java agents 
> and/or custom system class loaders and/or custom security managers 
> specified as command-line options. Perhaps this should be specified 
> explicitly.
If there is custom class loader and custom security manager then they 
are loaded/initialized before the main class is loaded. Ditto for tool 
agents specified on the command line or in the manifest as they are also 
loaded/initialized before the main class.

If the main class has an initializer then it won't normally run. I say 
"normally" because the custom class loader or an agent could be in 
cahoots with the main class and cause it to initialize before the 
launcher invokes the "main" method. My personal view is that this is way 
too much detail to attempt to capture in the brief description that is 
the usage message. I think we have to assume that the usage will be read 
by non-experts. So no issue with adjusting the message to make it 
clearer but we should limit it to a few lines. Here is the current output:

     --dry-run     create VM and load main class but do not execute main 
                   This --dry-run option may be useful for validating the
                   command-line options such as the module system 

"This --dry-run" should be "The --dry-run" but otherwise it seems a 
reasonable summary of what this option does.


More information about the jigsaw-dev mailing list