Invalid Header Field Name when adding manifest to JAR using Eclipse
Asked Answered
D

3

6

I'm using eclipse to develop a java applet and need to add an external jar to Class-Path in the manifest. I created the manifest file using notepad, used UTF-8 encoding and added the line break at the end, but attempting to add even a simple example manifest during jar creation results in the following error from Eclipse.

invalid header field name: ï>¿Manifest-Version
invalid header field name: ï>¿Manifest-Version

I have a feeling that it's some simple configuration issue, but I can't figure out what.

To test it, my manifest consists of the single line

Manifest-Version: 1.0
Dub answered 10/11, 2012 at 8:51 Comment(0)
F
8

Notepad save your file with a special mark named 'BOM' at the beginning : 2 bytes (U+FEFF) which identify UTF-8 format.

You have to edit the file with Notepad++ (or vi) and encode it as UTF-8 (without BOM).

Next steps to make JARs:

Frit answered 10/11, 2012 at 8:56 Comment(2)
That was it! I spent a good couple of hours trying to figure that out. Thanks a lot! I just found out about ANT, so I'll definitely look into that.Dub
Yes ANT is THE solution for cross platform complex project, later you'll see MAVEN (another step)Frit
F
1

In Notepad++ , from the encoding menu , choose encode in UTF-8 without BOM .

Fredette answered 17/5, 2016 at 9:41 Comment(1)
Great practical advice to remove BOM, upvote to improve visibility.Remake
T
0

In eclipse, right click in file properties and choose text file encoding to ISO-8859-1

Back in editor delete the special chars.

Thordis answered 30/9, 2015 at 13:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.