开发者

adding main class into the manifest file

开发者 https://www.devze.com 2023-03-17 02:14 出处:网络
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 ?

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

精彩评论

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

关注公众号