使用Eclipse将清单添加到JAR时,头文件名称无效 [英] Invalid Header Field Name when adding manifest to JAR using Eclipse

查看:590
本文介绍了使用Eclipse将清单添加到JAR时,头文件名称无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用eclipse来开发一个java小程序,需要在manifest中添加一个外部jar到Class-Path。我使用记事本创建了清单文件,使用UTF-8编码并在末尾添加了换行符,但是在创建jar文件期间尝试添加一个简单的示例清单会导致Eclipse发生以下错误。

 无效标题字段名称:ï¿¿Manifest-Version 
无效标题字段名称:ï显示版本

我有一种感觉,这是一些简单的配置问题,但我无法弄明白什么。



要测试它,我的清单由单行

 清单版本:1.0 


解决方案

记事本使用开始时命名为BOM的特殊标记:标识UTF-8格式的2个字节(U + FEFF)。



您必须使用记事本++(或vi)编辑文件,并将其编码为UTF-8(不含BO



下一步制作JAR:




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

解决方案

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:

这篇关于使用Eclipse将清单添加到JAR时,头文件名称无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆