为什么jar会忽略我的清单? [英] Why is jar ignoring my manifest?

查看:111
本文介绍了为什么jar会忽略我的清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用此命令创建一个可执行jar:

I tried to create an executable jar using this command:

jar -cvfm h.jar Manifest.mf Whatever1.class Whatever2.class

清单包含:

Main-Class: Whatever1

但如果我尝试运行jar,我得到:无法从my.jar 加载Main-Class清单属性。我提取了jar,我看到它的清单内容是这样的:

But if I try to run the jar, I get: Failed to load Main-Class manifest attribute from my.jar. I extracted the jar, and I saw that the contents of it's manifest were this:

Manifest-Version: 1.0
Created-By: 1.6.0_18 (Sun Microsystems Inc.)

为什么忽略我的清单?

编辑:我知道使用 -e 标志我可以指定一个入口点,jar会生成一个正确的清单,但我想知道如何使这个版本工作。

I know that using the -e flag I can specify an entry point, and jar will generate a correct manifest, but I'd like to know how to make this version work.

推荐答案

在最后一行之后添加一个换行符code> Manifest.mf

Add a line break after the last line of Manifest.mf

这篇关于为什么jar会忽略我的清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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