在netbeans中创建的jar文件未执行 [英] jar file created in netbeans not executing
问题描述
我在netbeans中编写了一些GUI程序,它使用swing并且工作正常。我通过右键单击项目> clean and build创建了jar文件,所有资源都包含在项目属性中.jar文件在dist文件夹中正在使用命令行执行
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
java -jar mig_log.jar
但每当我双击jar文件时,它会说无法找到主类。程序将退出。
我引用了这些链接,但没有任何结果:
在netbeans中生成可执行jar
but whenever I double click the jar file it says "Could not find the main class.Program will exit". I referred these links but nothing worked out : producing executable jar in netbeans
推荐答案
在Netbeans中,转到项目属性,然后在运行选项卡中,浏览并选择具有main()方法的Main Class,该方法启动GUI,然后清理并构建以创建jar文件。现在双clik JAR文件,让我知道结果。
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. Now double clik JAR file, and let me know result.
这篇关于在netbeans中创建的jar文件未执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!