jar,怎样修改(或添加)它的“Manifest”,使之能够作为较独立的应用程序运行?

qdzhulf 2001-12-26 03:00:03
java文档这样说:
“Special-Purpose Manifest Headers”
Applications Bundled as JAR Files - version 1.2 only
If you have an application bundled in a JAR file, you need some way to indicate which class within the JAR file is your application's entry point. (Recall that the entry point is the class having a method with signature public static void main(String[] args).)
You provide this information with the Main-Class header, which has the general form:

Main-Class: classname

The value classname is the name of the class that is your application's entry point.

我怎样添加 "Main-Class: classname" 呢?

...全文
101 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
masterz 2001-12-26
  • 打赏
  • 举报
回复
Manifest-Version: 1.0//这一行不需要
Main-Class: packagename.yourmainclass//用你的包名和你包含main方法的类路径
leolee 2001-12-26
  • 打赏
  • 举报
回复
Manifest-Version: 1.0
Main-Class: packagename.yourmainclass//用你的包名和你包含main方法的类路径

用文本写一个内容为样的文件,命名:MANIFEST.MF。
在你的类的最上层的包(目录)同一层建目录META-INF,在把刚才的文件放进去,就可以了。

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧