Jar is ignoring my manifest file and replaces it with auto-generated manifest.
my manifest is :
Manifest-Version: 1.0
Created-By: Student Name
Main-Class: ua.sumdu.j2se.studentName.tasks.PrintMonth
(with empty line)
cmd:
jar -cvf build/tasks.jar MANIFEST.MF build\classes\ua\sumdu\j2se\studentName\tasks\*.class
and as a result if I open jar file with winrar, there would be:
build
META-INF
MANIFEST.MF - my manifest
if i place manifest into META-INF and execute
jar -cvf build/tasks.jar META-INF/MANIFEST.MF build\classes\ua\sumdu\j2se\studentName\tasks\*.class
in my META-INF folder will be 2 manifests.
What's going on?
Use the M
option to disable the default META-INF/MANIFEST.MF
, or use the m
option to explicitly specify your own (documentation).
One more thing: the order of jar
options matters. If you put m
first, f
second, then jar
arguments need to go in the same order: manifest-file jar-file
, and vice versa.
The line in jar help I missed first:
The manifest file name, the archive file name and the entry point name are
specified in the same order as the 'm', 'f' and 'e' flags.
Also check that the last line of your manifest ends with a new line or carriage feed. I did not have a new line at the end of my manifest and this made it appear to be omitted.
I see you have (with empty line). But I arrived at this answer without one.
Try this jar -cmvf MANIFEST.MF build/tasks.jar build\classes\ua\sumdu\j2se\studentName\tasks\*.class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With