I am using jackcess for the conncetivity to my access database. But I am following exception
Exception in thread \"main\" java.lang.NoClassDefFoundError: or
Jackcess has a dependency on Jakarta Commons Lang. You need to make sure that the commons lang and the other dependencies are on your classpath.
Here's how I got Jackcess working, starting with a fresh install of NetBeans 7.4 on Windows 8:
I downloaded the latest Jackcess JAR file via the "Looking for the latest version?" link on files page. I saved it in the folder
C:\Users\Public\Java\
As listed on the Project Dependencies page for Jackcess, I downloaded the ZIPped binaries for the two required dependencies: commons-lang v2.x, and commons-logging v1.x. I unpacked the ZIP files into the above folder, so it now contained two sub-folders
C:\Users\Public\Java\commons-lang-2.6\
C:\Users\Public\Java\commons-logging-1.1.3\
I launched NetBeans and created a new Project (for a Java Application) named "myJackcessTest". I expanded the Project in the tree view, right-clicked "Libraries", chose "Add JAR/Folder...", and added the three JAR files:
Once that was done, I created my little test app...
package myjackcesstest;
import com.healthmarketscience.jackcess.*;
import java.io.File;
import java.io.IOException;
public class MyJackcessTest {
public static void main(String[] args) {
try {
Table table = DatabaseBuilder.open(new File("C:\\Users\\Public\\Database1.accdb")).getTable("Clients");
System.out.println(String.format("table contains %d row(s)", table.getRowCount()));
} catch (IOException e) {
e.printStackTrace();
}
}
}
...and when I hit F6 it ran fine:
run:
table contains 1 row(s)
BUILD SUCCESSFUL (total time: 0 seconds)