1

I am developing a Javafx application and its ready for the build. In order to read and write excel files I,m using org.apache.commons.compress library (a jar file), which has a main class named Lister in it. Where as, my application has its own MainApp class file (essential for a Javafx application). So, while I'm building the application, the build is successful and a jar file of my application is also generated but I am getting this error :

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.  

This means that there are two main files inside my jar.

Secondly, when I'm running executable jar of my application, it crashes.

EJ Dogar
  • 68
  • 10

1 Answers1

1

You can specify main class when creating the jar, by adding class name as MyClass:

java -cp myjar.jar MyClass
Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • I was using eclipse for building my jar file. Earlier I was extracting required jar libraries into generated jar due to which I was getting subject error. Therefore, I packaged required libraries into generated jar and it worked. Link provided by you gave me the hint. Thanks a lot cheers!!!! – EJ Dogar Oct 03 '19 at 03:52