简体   繁体   English

在netbeans中创建的jar文件无法执行

[英]jar file created in netbeans not executing

I have written some GUI program in netbeans which makes use of swing and it's working fine.I created jar file by right-clicking on project>clean and build and all the resources are included in it from project properties.The jar file in dist folder is executing through commandline using 我在netbeans中编写了一些GUI程序,该程序利用了swing并运行良好。我通过右键单击project> clean和build来创建jar文件,并且所有资源都来自项目属性。dist文件夹中的jar文件通过命令行执行使用

java -jar mig_log.jar

but whenever I double click the jar file it says "Could not find the main class.Program will exit". 但是,每当我双击jar文件时,它都会显示“找不到主类。程序将退出”。 I referred these links but nothing worked out : producing executable jar in netbeans 我引用了这些链接,但没有解决: 在netbeans中生成可执行jar

Could not find the main class 无法找到主类

In Netbeans, go to Properties of project, then in Run tab browse and select Main Class that has main() method which starts your GUI, and then clean and build to create jar file. 在Netbeans中,转到“项目的属性”,然后在“运行”选项卡中浏览并选择具有main()方法的Main Class,它会启动GUI,然后清理并生成以创建jar文件。 Now double clik JAR file, and let me know result. 现在双击cli JAR文件,并让我知道结果。

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

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