Generated JAR file is not executing

懵懂的女人 提交于 2019-12-12 03:42:30

问题


I have a java project which reads data from an the excel sheet (specified by the user), performs some filtering and creates a few text files and then writes the modified data to the text files.

The project is working fine and now I want to create a jar file for it. I created the jar file but it did not run. As far as the code is concerned it is running without any errors.I have used Netbeans for GUI. I also saw related questions which said it is not possible to create a text file from a running jar.

Is there a workaround?


回答1:


You need to specify the main class in the manifest of the jar file.

If you have an application bundled in a JAR file, you need some way to indicate which class within the JAR file is your application's entry point. You provide this information with the Main-Class header in the manifest, which has the general form: Main-Class: classname

http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html



来源:https://stackoverflow.com/questions/10655395/generated-jar-file-is-not-executing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!