1 message in net.java.dev.jna.usersRe: [jna-users] Setting jna.library.path
FromSent OnAttachments
Jøran Vagnby LillesandFeb 9, 2008 7:47 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Setting jna.library.pathActions...
From:Jøran Vagnby Lillesand (lill@stud.ntnu.no)
Date:Feb 9, 2008 7:47:21 am
List:net.java.dev.jna.users

Hi,

thanks for your response! Yes, I tried that with no luck. Is it possible that it may be related to internal dependencies/linkages within the C library I'm using? I have very little knowledge about C myself, so I don't know how to check whether this is the case. The exception certainly indicates that the problem is related to locating the dll file itself, though...

Best regards, Jøran

Timothy Wall wrote:

Have you tried setting jna.library.path when launching the VM, e.g.

java -Djna.library.path=xyzzy

If that works, then you have an order of execution problem.

On Feb 8, 2008, at 10:42 AM, Jøran Vagnby Lillesand wrote:

Hi!

I'm having some problems making the "jna.library.path" parameter work. I've tried setting it both absolutely and relative to the working directory, but it fails none the less. If I set the working directory to the directory containing the library I'm trying to use, it works fine, so I reckon the problem is that it isn't properly added to the search path. I've tried reviewing the JNA code, but I'm unable to see where the parameter is supposed to be added to the search path. The exception is as follows:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'vix': The specified module could not be found.

at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:114) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:157) at com.sun.jna.Library$Handler.<init>(Library.java:123) at com.sun.jna.Native.loadLibrary(Native.java:259) at com.sun.jna.Native.loadLibrary(Native.java:245)

(calls within my own classes has been omitted).

I set the path as follows: System.setProperty("jna.library.path", "c:\\workspace\\project\\lib\\");

And I load the instance as follows: VixInterface INSTANCE = (VixInterface) Native.loadLibrary("vix", VixInterface.class);

I hope this sufficiently describes the situation!

Best regards, Jøran Vagnby Lillesand