Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is java.io.IOException: invalid header field?

When i try to run the following command :

jar cvfm myjar.jar manifest.txt *.class

I get the following exceptions :

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:171)
    at sun.tools.jar.Main.main(Main.java:1176)

What could be the reason i am getting these exceptions ?

like image 200
Suhail Gupta Avatar asked Feb 14 '12 10:02

Suhail Gupta


2 Answers

I'm guessing that there's a problem with your manifest file. Give it a look to see if you've got a typo in the name of a header variable.

like image 93
duffymo Avatar answered Oct 11 '22 14:10

duffymo


Check that your manifest.txt file contains the content in this manner :

Main-Class: <"package-name">.<"Main-class-name">.class <"newline">

Note that newline/carriage-return is necessary for parsing.

Refer to this link http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

like image 31
dograditya Avatar answered Oct 11 '22 14:10

dograditya