1

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?

4

1 回答 1

0

默认情况下,JAR 文件被添加到文件系统的类路径中,其相对位置与向导中指定的相同,因此可执行文件将无法单独运行。

exe4j 具有“JAR in EXE”模式,其中类路径中的所有 JAR 文件都打包到可执行文件中。资源文件不能以这种方式打包。如果您需要 JAR 文件以外的资源(如 DLL),则必须使用常规模式并将可执行文件与所有支持文件一起提供。

于 2018-01-16T20:44:05.797 回答