UCANACCESS_HOME system variable not set

别等时光非礼了梦想. 提交于 2019-12-12 11:19:03

问题


I'm trying to use UCanAccess to connect a Java application to an Access database but when I run my Java app I get the error that

UCANACCESS_HOME system variable isn't defined...

I have added the six jar files to the project library in NetBeans. I've also added the path to the directory where the ucanaccess-3.0.3.jar file is stored to the PATH system variable in Windows 10. I also tried creating a new system variable UCANACCESS_HOME with no luck.

Any help that could point me in the right direction would be greatly appreciated.


回答1:


You can either

(1) ensure that your CLASSPATH includes the ucanaccess-x.x.x.jar and the four (4) jar files in the "lib" directory of the UCanAccess distribution,

or

(2) ensure that your CLASSPATH includes just the ucanload.jar from the "loader" folder, and set a Java system property named UCANACCESS_HOME when you launch the Java virtual machine, e.g., by using the -Dproperty=value switch

-DUCANACCESS_HOME=<directory into which you unpacked the UCanAccess binary distribution>

That is, UCANACCESS_HOME must point to the directory that directly contains ucanaccess-x.x.x.jar after decompressing the UCanAccess distribution zip file. For example:

-DUCANACCESS_HOME=/home/gord/Downloads/JDBC/UCanAccess-3.0.1-bin

The two configurations are mutually exclusive. The first one is the generally adopted one.

The second one leverages the JDBC driver classloading mechanism in order to load dependencies with a different classloader. If an application already uses specific versions of HSQLDB, commons-lang, commons-logging, and/or Jackcess then ucanload.jar can be used to avoid conflicts between different versions of those jars eventually used by your application. In other words, using this approach you can be sure that your application continues to use the (other) versions of HSQLDB, commons-lang, commons-logging, and/or Jackcess that it used before, while UCanAccess uses the ones in its distribution.




回答2:


Thanks for the help jamadei.

I determined that the issue was with the path to the .mdb file in my code. Rather than using a relative path, I used an absolute. This wasn't an issue with the Ucanaccess driver.

In addition, I needed to remove the ucanload jar from the project.




回答3:


After so many of tries finally I think I have found a solution... try to create a new database and restart your database and text editor



来源:https://stackoverflow.com/questions/34464565/ucanaccess-home-system-variable-not-set

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