I wrote a Java FX Tool, which connects to an .accdb database and created an executable JAR file from it which works very well. In the same folder of the JAR file, I have several JAR libraries, which I need in order to connect to my database.
Now I want to create an executable file (.exe) from the executable JAR with exe4j. To do so, in the step "Java invocation", under "Advanced Options", I added a folder including these required libraries as a "library directory".
I now run the resulting .exe and my application opens, but when I try to connect to my database (by clicking a button in my application) it doesn't work and I get this Exception:
java.lang.ClassNotFoundException: net.ucanaccess.jdbc.UcanaccessDriver
So obviously it failed to include my required libraries.
How exactly do I have to proceed in exe4j to include multiple JAR libraries besides my actual executable JAR?
By default, JAR files are added to the class path from the file system with the same relative location as specified in the wizard, so the executable will not be runnable on its own.
exe4j has a "JAR in EXE" mode where all JAR files in the class path are packed into the executable. Resource files cannot be packed that way. If you need resources other than JAR files (like a DLL), you have to use the regular mode and ship the executable together with all supporting files.