I am trying to use a package in my final year project called libfprint. This is an opensource fingerprint reader SDK. I am doing my project in Java so I need to port over the libfprint functionality.
A stroke of good luck hit me and turned out somebody already did this. A package called jlibfprint is a JNI wrapper for libfprint.
So I followed the instructions in both jlibfprint and libfprint for setup. libfprint more or less works fine. As for jlibfprint, when I tried to run the sample program I got,
Exception in thread "main" java.lang.UnsatisfiedLinkError: no JlibFprint_jni in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at JlibFprint.<clinit>(JlibFprint.java:28)
at SampleRun.main(SampleRun.java:30)
JlibFprint.(JlibFprint.java:28)
is referring to
static {
System.loadLibrary("JlibFprint_jni");
}
So now I'm looking through the project properties and get to the field "Native library location", and I point it to the directory containing a single file called libJlibFprint_jni.so.
Now when I run the program, the error I get is,
Exception in thread "main" java.lang.UnsatisfiedLinkError: JlibFprint.enroll_finger()LJlibFprint$fp_print_data;
at JlibFprint.enroll_finger(Native Method)
at SampleRun.main(SampleRun.java:36)
Enroll the first finger...
Here are the sample Java file
SampleRun.java
public class SampleRun {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
JlibFprint jlibfprint = new JlibFprint();
JlibFprint.fp_print_data pd1, pd2;
int matchValue;
try
{
System.out.println("Enroll the first finger...");
pd1 = jlibfprint.enroll_finger();
System.out.println("Compare the previous acquisition with the next one...");
pd2 = jlibfprint.enroll_finger();
matchValue = JlibFprint.img_compare_print_data(pd1, pd2);
System.out.println(matchValue);
if (matchValue > JlibFprint.BOZORTH_THRESHOLD)
{
System.out.println("[OK] The two fingerprints are compatible!");
}
else
{
System.out.println("[FAIL] The two fingerprints are not compatible!");
}
}
catch (JlibFprint.EnrollException e)
{
System.err.format("Enroll Exception [%d]\n", e.enroll_exception);
e.printStackTrace();
}
}
}
I am using Ubuntu 11.10 with Eclipse Juno.
Anybody with a breeze of knowledge in this area would be a great help !
Just found the solution here. I'm sure it was obvious to some but JNI is totally new to me. The solution was:
"Create a new file in /etc/ld.so.conf.d/ called .conf
Edit the file and add a line per directory of shared libraries (*.so files), it will look something like:
/usr/lib/APPLICATION/lib Reload the list of system-wide library paths: sudo ldconfig"