Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JNI unsatisfied link error on ubuntu

I am using Java with Netbeans under Ubuntu. I am working with JNI and want to load the dll where in linux it has the ".so" extension. Why this piece of code is working:

static {
    System.load("/home/user/NetBeansProjects/JD2XX-DLL2/dist/jd2xx.so");
}

But this isn't:

static {
    System.loadLibrary("jd2xx");
}

with VM Options specified in netbeans to:

-Djava.library.path="/home/user/NetBeansProjects/JD2XX-DLL2/dist/"

I am getting an error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 
  no jd2xx.so in java.library.path

This works for me under Windows.

like image 371
Radek Avatar asked Feb 20 '23 15:02

Radek


1 Answers

On a Unix system,

System.loadLibrary("Foo");

looks for a file called libFoo.so in the library search paths.

Rename the file accordingly.

By contrast, on a Windows system that call will look for a file called Foo.dll in the library search paths.

like image 196
QuantumMechanic Avatar answered Feb 23 '23 05:02

QuantumMechanic