UCanAccess driver not found when converted to JAR file

£可爱£侵袭症+ 提交于 2019-11-28 14:31:14

Unlike Eclipse, NetBeans does not offer a standard way to Export a Java project to a single runnable JAR file that contains all of the project's dependencies. Instead, when you Build a Java project in NetBeans it creates a \dist folder that contains

  • the JAR file for your own Java code, plus

  • a \lib subfolder containing the JAR files for the dependencies.

When you distribute your Java project to other users, Packaging and Deploying Desktop Java Applications says that you need to

  1. Create a zip file that contains the application JAR file (YourStuff.jar) and the accompanying lib folder that contains [the additional jar files that your application requires].

  2. Send the file to the people who will use the application. Instruct them to unpack the zip file, making sure that the main application jar file and the lib folder are in the same folder. The users of your application should be able to run it by double-clicking the JAR file.

For example, when I unpack the zip file for my test application I have

[C:\__tmp]
    README.TXT
    UCanAccessDemo.jar
    [\lib]
        commons-lang-2.6.jar
        commons-logging-1.1.1.jar
        hsqldb.jar
        jackcess-2.0.6.jar
        ucanaccess-2.0.9.2.jar

A quick web search revealed at least one mechanism that claims to allow NetBeans to create a single monolithic JAR file that includes dependencies ...

PackagingADistributableJavaApp

... but I have not tried it myself. (I just get Eclipse to do it.)

Do you have export lib files within .jar file? There are some dependency classes which are required to connect to database which also need to be included with .jar file, or you can copy all required dependency to folder named as lib in same folder where your .jar file exist.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!