Main class in jar
Alan Bateman
Alan.Bateman at oracle.com
Mon Mar 5 15:40:29 UTC 2018
On 05/03/2018 13:58, Gregg Wonderly wrote:
> Will java -jar note that the argument is a module and help the user understand how to invoke it, or will it just complain about a missing main-class: attribute? From a practical perspective, why does it matter and demand a different command line? What happens when you double click on a module?
>
`java -jar` has not changed, it will print an error to say that there
is "no main manifest attribute" as it has always done.
If your modules aren't in the run-time image then you have to specify a
module path to the java launcher. This is different to `java -jar` where
you've packaged everything into a single JAR file (ignoring Class-Path
in the this discussion for now). As I said, there is a carry over issue
from JSR 376 to examine the topic of executable modular "uber JARs" so I
expect it will be re-examined.
I assume by "double on a module" then you mean a JAR file. In that case
it depends on how your desktop is configured. Some users may have it
configured to run "javaw.exe" with `-jar %1` as the parameters, this
would be the equivalent of typing `java -jar ...` on the command line.
-Alan
More information about the jigsaw-dev
mailing list