1

我正在开发一个Javafx应用程序并准备好构建。为了读取和写入 excel 文件,我使用org.apache.commons.compress库(一个jar文件),其中有一个名为的主类Lister。其中,我的应用程序有自己的MainApp类文件(对应用程序至关重要Javafx)。所以,当我构建应用程序时,构建成功并且我的应用程序的 jar 文件也生成了,但我收到了这个错误:

The jar libs\commons-compress-1.18.jar has a main class  
org.apache.commons.compress.archivers.  
Lister that does not match the declared main org.dracul.tree.MainApp
Bundler EXE Installer skipped because of a configuration problem: Main application jar is missing.  

这意味着我的 jar 中有两个主要文件。

其次,当我运行我的应用程序的可执行 jar 时,它会崩溃。

4

1 回答 1

1

您可以在创建 jar 时指定主类MyClass,方法是将类名添加为:

java -cp myjar.jar MyClass
于 2019-09-16T09:20:28.957 回答