Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Header Field Name when adding manifest to JAR using Eclipse

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
like image 649
pLiKT Avatar asked Nov 10 '12 08:11

pLiKT


People also ask

Where do I put manifest file in JAR?

The manifest file is named MANIFEST. MF and is located under the META-INF directory in the JAR. It's simply a list of key and value pairs, called headers or attributes, grouped into sections.

Where is manifest file in eclipse?

Right-click Project -> Export -> Java/JAR file, Next, JAR File Specification, Next, JAR Packaging Options, Next, JAR Manifest Specification. in it.

What is manifest file in Java JAR?

The manifest is a special file that can contain information about the files packaged in a JAR file. By tailoring this "meta" information that the manifest contains, you enable the JAR file to serve a variety of purposes.


1 Answers

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:

  • Using eclipse
  • Using Apache ANT
  • Using Apache Maven
like image 52
Aubin Avatar answered Sep 18 '22 13:09

Aubin