简体   繁体   English

Jackcess编译错误

[英]Jackcess compilation error

i have been searching around for a few days for the answer to this and i just can't seem to get it to work. 我已经寻找了几天的答案,但似乎无法正常工作。 I have seen exact examples where it is working for them and I try exactly what they do and it is just not working for me. 我已经看到了一些对他们有用的确切例子,我尝试了他们所做的一切,但对我却没有用。

Basically what i am trying to do is open a local access DB. 基本上我想做的是打开本地访问数据库。 I have tried numerous methods and this Jackcess seems by far the best library to use, so i am trying to get it to work with that. 我尝试了许多方法,而该Jackcess似乎是迄今为止最好的库,因此我正在尝试使其使用。 I have read their cookbook and gone through all of that, and still no luck so i am coming to you guys in the hope of finding a good solution (i have not posted this question anywhere yet). 我已经阅读了他们的食谱并经历了所有这些,但是仍然没有运气,所以我来找你们,希望找到一个好的解决方案(我还没有在任何地方发布这个问题)。 Here is my code (the relevant part) 这是我的代码(相关部分)

The only syntax error i am getting is "DatabaseBuilder.Open" and the error is it cannot find the method, even though i have the libraries included for IO 我得到的唯一语法错误是“ DatabaseBuilder.Open”,错误是它找不到方法,即使我为IO提供了库

import com.healthmarketscience.jackcess.*;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

   Database db = DatabaseBuilder.open(new File("my.mdb"));
    try {
        Table table = db.getTable("Teams");
    } catch (IOException ex) {
        Logger.getLogger(Teams.class.getName()).log(Level.SEVERE, null, ex);
    }

}   

Any help would be greatly appreciated! 任何帮助将不胜感激!

The program fails to debug once I have click this buttone the only actual message i can fine is 我单击此按钮后,程序无法调试,我可以罚款的唯一实际消息是

"Cannot find symbol Symbol : Method Open(file) Location : variable.DatabaseBuilder of type Object" “找不到符号符号:方法Open(文件)位置:variable.DatabaseBuilder类型的对象”

To use Jackcess you must have at least the following items in the build path for your Java project (or on your CLASSPATH): 要使用Jackcess,您的Java项目(或CLASSPATH)的构建路径中至少必须具有以下各项:

  • the Jackcess JAR file itself, and Jackcess JAR文件本身,以及

  • the JAR files for its two mandatory compile-time dependencies from Apache: commons-lang and commons-logging. JAR文件,因为它具有来自Apache的两个强制编译时依赖性 :commons-lang和commons-logging。

In the Eclipse IDE that will look something like this: 在Eclipse IDE中,看起来像这样:

Eclipse.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM