java -jar should run in module mode if the jar is a mdular jar
Remi Forax
forax at univ-mlv.fr
Tue Dec 6 10:40:34 UTC 2016
----- Mail original -----
> De: "mark reinhold" <mark.reinhold at oracle.com>
> À: "Thomas Watson" <tjwatson at us.ibm.com>
> Cc: jigsaw-dev at openjdk.java.net
> Envoyé: Lundi 5 Décembre 2016 18:04:43
> Objet: Re: java -jar should run in module mode if the jar is a mdular jar
> 2016/12/5 6:15:48 -0800, tjwatson at us.ibm.com:
>> This makes sense to me,
>
> I agree that it makes sense, though it does take away the ability to run
> a modular JAR easily as an unnamed module -- I don't know how important
> that is to anyone.
There are two main classes. The one specified in module-info.class and the one specified in the Manifest.
And, jar --main-class set the two values at the same times.
So currently if you run the application with java ... -m modulename it runs the code in 'module mode' while if you run the application with java -jar, the code run inside the unnamed module.
I think it's better to have -jar that run its main in a module instead of in the unnamed module.
Other solution slike adding a -mjar command will not work because you want to be able to run a fat jar by double-clicking on it.
>
>> but then I wonder if the main class is specified
>> in the module-info.class as some type of service or if you continue to
>> specify that in the jar manifest.
>
> If we do implement this then the logical approach would be to interpret
> the `MainClass` attribute of the `module-info.class` file.
>
yes
> - Mark
Rémi
More information about the jigsaw-dev
mailing list