Why can't main class be given in module-info.java?

Remi Forax forax at univ-mlv.fr
Thu Feb 23 11:09:33 UTC 2017

Hi Gunnar,
all module metadata, the main-class but also the version, the os etc, are injected by the jar command.

In 8, the MainClass (or all of metadata that are in the manifest) only exist from the runtime point of view after being put inside of a jar, so in order to be the less disruptive possible for the existing build processes, we have chosen to keep the same strategy. This also allow us to support application that are built by compiling the code once and split the generated classes in several jars afterwards.


----- Mail original -----
> De: "Gunnar Morling" <gunnar at hibernate.org>
> À: "jigsaw-dev" <jigsaw-dev at openjdk.java.net>
> Envoyé: Mercredi 22 Février 2017 23:44:59
> Objet: Why can't main class be given in module-info.java?

> Hi,
> Why is it that the binary form of module declarations can carry
> information on a main class ("ModuleMainClass" attribute), but no main
> class can be specified in module-info.java?
> It seems setting ModuleMainClass is left to the jar tool, but I'd like
> to understand the rationale behind it.
> Thanks,
> --Gunnar

More information about the jigsaw-dev mailing list