Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOException: 'Invalid header field; when creating .jar file with manifest

When I type jar cvfm file_name.jar manifest.txt *.class in command prompt I get this error:

java.io.IOException: invalid header field
    at java.util.jar.Attributes.read(Attributes.java:410)
    at java.util.jar.Manifest.read(Manifest.java:199)
    at java.util.jar.Manifest.<init>(Manifest.java:69)
    at sun.tools.jar.Main.run(Main.java:172)
    at sun.tools.jar.Main.main(Main.java:1177)

I've never gotten this error before and I can't find anything on it, what does it mean?

like image 962
grim_v3.0 Avatar asked Sep 20 '13 01:09

grim_v3.0


2 Answers

Be careful about the order of the parameters:

1) jar cvmf manifest.txt some.jar package/*class
2) jar cvfm some.jar manifest.txt package/*class
like image 59
Wenjay Chnag Avatar answered Oct 06 '22 08:10

Wenjay Chnag


Check the name of a header variable in the MANIFEST file. MANIFEST file is not correct.

This tutorial will help to identify the MANIFEST file format and related things, http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html

like image 33
Ragavan Avatar answered Oct 06 '22 08:10

Ragavan