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

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

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


In case you land here and tried everything and still isn't getting rid of the problem, take a look if there are any accidental tabs instead of 4 spaces for indentation in the MANIFEST file.

I was using a maven pom.xml file to auto-generate the MANIFEST and the property line was too big, spanning multiple lines like this:

<Extension-List> item1 item2 item3 item4
                item5 item6 item7 item8    <--- these lines are idented with tabs
                item9 item10 item11 item12 </Extension-List>

this was corrupting the MANIFEST file in a very hard to see way.