简体   繁体   English

运行Jar文件时出错

[英]Error running Jar File

I have created a project in java project using NetBeans IDE. 我已经使用NetBeans IDE在Java项目中创建了一个项目。 I have few forms in it. 我的表格很少。 The netBeans created a Jar file by its own. netBeans自行创建了一个Jar文件。 when i try to run that Jar file its give an error "Failed to load Main-Class manifest attribute from". 当我尝试运行该Jar文件时,给出错误“无法从中加载Main-Class清单属性”。 I Have set my Starting form in application and when i run from netbeans its running correctly but when i try to run my Jar file its give me this error. 我已经在应用程序中设置了我的启动表单,当我从netbeans运行时,它的运行正常,但是当我尝试运行Jar文件时,它给了我这个错误。 Please any one can help me how to solve this netbeans. 请任何人可以帮助我如何解决此netbeans。 Thanks 谢谢

I don't use NetBeans myself, but there's a good step-by-step guide which has screenshots for everything you need to build an executable jar file. 我自己不使用NetBeans,但是有一个很好的循序渐进指南 ,其中提供了构建可执行jar文件所需的所有屏幕截图。

In particular, did you fill in the "Main Class" property in the project properties? 特别是,您是否在项目属性中填写了“ Main Class”属性? I know you says you've filled in the "Starting form" but that may not be the same thing... 我知道您说您已经填写了“开始表格”,但是可能不一样...

Look in the MANIFEST.MF file in the jar file. 在jar文件中的MANIFEST.MF文件中查找。 It should contain a Main-Class line containing the name of the class you want to start when invoking in this manner. 它应包含一个Main-Class行,其中包含以这种方式调用时要启动的类的名称。 If the line is there, doublecheck the spelling of both the class name and Main-Class. 如果该行在那里,请仔细检查类名和Main-Class的拼写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM