这是我第一次尝试这样做......我试图获取到我的数据库的链接,然后显示一个表格以查看链接是否已建立。出于某种原因,它只是不起作用。这是我的代码:
package dbtest;
import java.io.*;
import com.healthmarketscience.jackcess.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DbTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try
{
Database db = DatabaseBuilder.open(new File("Users\\ou_snaaksie\\NetBeansProjects\\dbTest\\MOVIES.mdb"));
Table tblMOVIES = db.getTable("tblMOVIES");
System.out.println(tblMOVIES.toString());
}
catch (IOException ex)
{Logger.getLogger(DbTest.class.getName()).log(Level.SEVERE, null, ex);}
}
}
我得到的错误是:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.healthmarketscience.jackcess.impl.DatabaseImpl.<clinit>(DatabaseImpl.java:91)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:170)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:193)
at dbtest.DbTest.main(DbTest.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)