开发者

adding main class into the manifest file

I created a jar file like this :

jar cf myJAR.jar *.class

But this thing is not executable because the mainfest file does not know in which .class file is 开发者_StackOverflow社区the main file ?

Now how can i set the main class into the manifest file ?


The manifest file must include the following line

Main-Class: MyPackage.MyClass

In JDK6 there is a commandline parameter to add it automatically

jar cfe Main.jar foo.Main foo/Main.class

foo is the package in this example. The second example creates the manifest automatically.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜