我有一个java项目,它从Excel工作表(由用户指定)读取数据,执行一些过滤并创建一些文本文件,然后将修改后的数据写入文本文件。
该项目运行良好,现在我想为其创建一个 jar 文件。我创建了 jar 文件,但它没有运行。就代码而言,它运行没有任何错误。我使用 Netbeans 作为 GUI。我还看到了相关问题,这些问题说不可能从正在运行的 jar 创建文本文件。
有解决办法吗?
最佳答案
您需要在 jar 文件的 list 中指定主类。
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
关于java - 生成的 JAR 文件未执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10655395/