我的 .jar 文件不是从 Netbeans 创建的可执行文件,为什么?
好的,我对 Java 很陌生。我觉得真的很难。我的学校作业几乎已经完成,除了一件事。创建可运行的 .jar 文件。我疯狂地用谷歌搜索自己。当我清理并构建我的项目时,会创建一个 jar 文件。它也有一个清单文件,但它不包括我的起始类。我确实尝试在属性中更改它,所以当我检查时它实际上说 wich 类是起始类。但是,它最终不会出现在清单文件中。这是由于某些错误造成的?我尝试打开 .jar,更改清单文件,以便它确实显示正确的启动文件。通过添加这一行: Main-Class: uppgift4.RunGame 但它仍然没有按预期运行。我刚刚收到一条错误消息,上面写着检查控制台..
我真的不知道我做错了什么...!!有什么想法吗?我使用的是 Mac 操作系统,我不使用 winzip 来解压缩文件。
//特蕾莎
Ok, so I am very new to Java. I find it really hard. I have an assignment from school that is almost finished, except one thing. Creating a runnable .jar file. I have googled myself crazy.. When I clean and build my project a jar file is created. It has a manifest file too, but it does not include my start class. I did try and change this in properties, so when I check it actually says wich class is the start class. But, it does however not end up in the manifest file. This is due to some bug? I have tried to just open up the .jar, change the manifest file so it does say correct startfile. By adding this line:
Main-Class: uppgift4.RunGame But it still does not run as it should. I just get en error message which says check the console..
I really don't know what I am doing wrong...!! Any ideas? Im on a Mac OS and I don't use winzip to unzip files.
//Therese
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,当出现此类问题时,您应该注意以下几点:
解决这些问题并且 netbeans 正在运行该程序后,如果仍然存在问题,在 netbeans 论坛 了解为什么编译后的 jar 无法运行(可能是 netbeans 制作的 ANT 脚本有问题)。您不需要自己编辑清单文件。希望这会有所帮助。
Usually, when problems like this occur, there are a couple things you should take a look at:
Once you have those ironed out and netbeans is running the program, if there are still problems, it may help to ask on the netbeans forums about why your compiled jar does not run (there may be a problem with the netbeans made ANT script). You should not need to edit the manifest file yourself. Hope this helps.