问题
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
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
Could not find the main class
回答1:
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.
来源:https://stackoverflow.com/questions/14143015/jar-file-created-in-netbeans-not-executing