使用 Eclipse 将清单添加到 JAR 时出现无效的标头字段名称 [英] Invalid Header Field Name when adding manifest to JAR using Eclipse
问题描述
我正在使用 eclipse 开发一个 java 小程序,需要向清单中的 Class-Path 添加一个外部 jar.我使用记事本创建了清单文件,使用了 UTF-8 编码并在最后添加了换行符,但是在 jar 创建期间尝试添加一个简单的示例清单会导致 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
推荐答案
记事本用名为BOM"的特殊标记保存您的文件 开头:2 个字节 (U+FEFF),用于识别 UTF-8 格式.
Notepad save your file with a special mark named 'BOM' at the beginning : 2 bytes (U+FEFF) which identify UTF-8 format.
您必须使用 Notepad++(或 vi)编辑文件并将其编码为 UTF-8(不带 BOM).
You have to edit the file with Notepad++ (or vi) and encode it as UTF-8 (without BOM).
制作 JAR 的后续步骤:
Next steps to make JARs:
- 使用日食
- 使用Apache ANT
- 使用 Apache Maven
这篇关于使用 Eclipse 将清单添加到 JAR 时出现无效的标头字段名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!