如何创建实际运行的.jar文件? [英] How to create a .jar file that actually runs?
问题描述
创建.jar文件时遇到了很多麻烦。每次我尝试创建一个它时,会弹出一个错误窗口,并说无法找到主类Start。 (我的主要课程名为Start)我有一个清单,你可以告诉我我做错了什么,或者告诉我到底做了什么?这可以来自命令提示符或来自eclipse!
I am having lots of trouble with Creating a .jar file. every time i try to create one it, an error window pops up and says that the main class Start can not be found. (My main class is named Start) I have a manifest and everything can you tell me what i'm doing wrong please, or tell me what do do exactly? This can be from the command prompt or from eclipse as well!
有时命令提示符窗口会弹出一毫秒然后立即关闭!
Also sometimes a command prompt window pops up for a millisecond then closes in an instant!
我的清单上写着:
Manifest-Version: 1.0
Main-Class: Start
我的主要类是Start.class
My main class is Start.class
推荐答案
这是我对你模糊问题的模糊回答。它可以是各种各样的东西。但最可能的一个是你已经在一个包中声明了Start类,并且没有在清单中放置完全限定的类名。
Here's my vague answer to your vague problem. It can be a variety of things. But the most probable one is than you have declared the Start class inside a package and didn't put the fully qualified class name in the manifest.
假设你有包声明的Start类是 foo.bar.lazy
你需要给 Main-Class:foo.bar.lazy.Start
。
Assuming the package you have declared Start class in is foo.bar.lazy
you need to give Main-Class: foo.bar.lazy.Start
.
这篇关于如何创建实际运行的.jar文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!