Why is the bank ignoring my manifest?

I tried to create an executable jar using this command:

jar -cvfm h.jar Manifest.mf Whatever1.class Whatever2.class 

the manifest contains the following:

 Main-Class: Whatever1 

But if I try to start the jar, I get: Failed to load Main-Class manifest attribute from my.jar . I removed the jar and I saw that the contents of its manifest are as follows:

 Manifest-Version: 1.0 Created-By: 1.6.0_18 (Sun Microsystems Inc.) 

Why was my manifest ignored?

EDIT: I know that with the -e flag I can specify an entry point and the jar will generate the correct manifest, but I would like to know how to make this version work.

+6
java jar manifest
source share
3 answers

Add line break after last line Manifest.mf

+15
source share

I noticed that the lack of a new line at the end of the manifest file sometimes causes this problem. See if adding a new line at the end of the manifest file helps.

+2
source share

I suppose you need to run jar like:

jar -cvf h.jar -m Manifest.mf Whatever1.class Whatever2.class

Since the parameter values ​​appear immediately after the option itself.

0
source share

All Articles