Bernard Amade
2018-03-05 09:54:41 UTC
Hello all
the doc in https://docs.oracle.com/javase/9/docs/specs/jar/jar.html
lists for Main-Class entry in jars:
"attribute defined for stand-alone applications: This attribute is used by stand-alone applications that are bundled into executable jar files which can be invoked by the java runtime directly by running "java -jar x.jar".
apparently it means that you should not create a modular jar with a manifest template containing a Main-Class entry
(apparently if you run the app with command "java -module-path dir -m com.thing.app" with the generated com.thing.app.jar the main class will not be found : you get a message saying you've got no Mainclass atrribute)
but if you generate the jar with a manifest template with no Main-Class entry and instead use the --main-class option then the main class will be found.
funnily the MANIFEST-MF will then have the same Main-Class entry!
so what is the difference?
(btw I suggest more docs that differentiate clearly what to do
1) with non-modular jars
2) with modular jars ..
... or is it I can't read the doc properly?)
thanks
Bear
the doc in https://docs.oracle.com/javase/9/docs/specs/jar/jar.html
lists for Main-Class entry in jars:
"attribute defined for stand-alone applications: This attribute is used by stand-alone applications that are bundled into executable jar files which can be invoked by the java runtime directly by running "java -jar x.jar".
apparently it means that you should not create a modular jar with a manifest template containing a Main-Class entry
(apparently if you run the app with command "java -module-path dir -m com.thing.app" with the generated com.thing.app.jar the main class will not be found : you get a message saying you've got no Mainclass atrribute)
but if you generate the jar with a manifest template with no Main-Class entry and instead use the --main-class option then the main class will be found.
funnily the MANIFEST-MF will then have the same Main-Class entry!
so what is the difference?
(btw I suggest more docs that differentiate clearly what to do
1) with non-modular jars
2) with modular jars ..
... or is it I can't read the doc properly?)
thanks
Bear