如何创建实际运行的.jar文件? [英] How to create a .jar file that actually runs?

查看:199
本文介绍了如何创建实际运行的.jar文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建.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屋!

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