MS Accessデータベースからデータを表示しようとしています。Jackcessライブラリを使用していますが、解決方法がわからない依存関係エラーが発生します。これが私のコードとエラーです:
import com.healthmarketscience.jackcess.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import java.nio.*;
import java.lang.*;
import org.apache.commons.*;
import org.apache.commons.lang3.builder.*;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
class Main {
private static Logger log=Logger.getLogger(Main.class);
public static void main(String args[]) {
DOMConfigurator.configure("lib\\log4j.xml");
try {
Database d = Database.open(new File("lib\\ExTables.mdb"));
System.out.println(d.getTable("Cliente").display());
} catch(Exception e) {
e.printStackTrace();
}
}
}
これが私のエラーです:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/builder/CompareToBuilder
at com.healthmarketscience.jackcess.RowId.compareTo(RowId.java:108)
at com.healthmarketscience.jackcess.IndexData$Entry.compareTo(IndexData.java:1825)
at com.healthmarketscience.jackcess.IndexData$Entry.compareTo(IndexData.java:1637)
at java.util.Collections.indexedBinarySearch(Unknown Source)
at java.util.Collections.binarySearch(Unknown Source)
at com.healthmarketscience.jackcess.IndexData$DataPage.findEntry(IndexData.java:2347)
at com.healthmarketscience.jackcess.IndexData.findEntryPosition(IndexData.java:709)
at com.healthmarketscience.jackcess.IndexData.access$3100(IndexData.java:54)
at com.healthmarketscience.jackcess.IndexData$EntryCursor.updatePosition(IndexData.java:2118)
at com.healthmarketscience.jackcess.IndexData$EntryCursor.restorePosition(IndexData.java:2057)
at com.healthmarketscience.jackcess.IndexData$EntryCursor.restorePosition(IndexData.java:2040)
at com.healthmarketscience.jackcess.IndexData$EntryCursor.beforeEntry(IndexData.java:2002)
at com.healthmarketscience.jackcess.IndexCursor.findPotentialRow(IndexCursor.java:439)
at com.healthmarketscience.jackcess.IndexCursor.findRowByEntryImpl(IndexCursor.java:342)
at com.healthmarketscience.jackcess.IndexCursor.findRowByEntry(IndexCursor.java:175)
at com.healthmarketscience.jackcess.Database$DefaultTableFinder.findRow(Database.java:2239)
at com.healthmarketscience.jackcess.Database$TableFinder.findObjectId(Database.java:2168)
at com.healthmarketscience.jackcess.Database.readSystemCatalog(Database.java:1081)
at com.healthmarketscience.jackcess.Database.<init>(Database.java:765)
at com.healthmarketscience.jackcess.Database.open(Database.java:589)
at com.healthmarketscience.jackcess.Database.open(Database.java:535)
at com.healthmarketscience.jackcess.Database.open(Database.java:510)
at com.healthmarketscience.jackcess.Database.open(Database.java:488)
at com.healthmarketscience.jackcess.Database.open(Database.java:467)
at Main.main(Main.java:19)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.builder.CompareToBuilder
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 25 more
これが私のコマンドラインです。
C:\Programmi\Java\jre6\bin\javaw.exe -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:3280 -Dfile.encoding=Cp1252 -classpath "C:\Documents and Settings\linosa\Documenti\programmazione\workspace_java\MSAccess\bin;C:\Documents and Settings\linosa\Documenti\programmazione\workspace_java\MSAccess\lib\jackcess-1.2.5.jar;C:\Documents and Settings\linosa\Documenti\programmazione\workspace_java\MSAccess\lib\log4j-1.2.16.jar;C:\Documents and Settings\linosa\Documenti\programmazione\workspace_java\MSAccess\lib\commons-logging-1.1.1.jar;C:\Documents and Settings\linosa\Documenti\programmazione\workspace_java\MSAccess\lib\junit-4.10.jar;C:\Documents and Settings\linosa\Documenti\programmazione\commons-lang3-3.1-bin\commons-lang3-3.1\commons-lang3-3.1-tests.jar;C:\Documents and Settings\linosa\Documenti\programmazione\commons-lang3-3.1-bin\commons-lang3-3.1\commons-lang3-3.1.jar;C:\Documents and Settings\linosa\Documenti\programmazione\commons-lang3-3.1-bin\commons-lang3-3.1\commons-lang3-3.1-javadoc.jar;C:\Documents and Settings\linosa\Documenti\programmazione\commons-lang3-3.1-bin\commons-lang3-3.1\commons-lang3-3.1-sources.jar" Main