Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

UnsatisfiedLinkError In Exported Jar But Not In Eclipse

4 views
Skip to first unread message

cppaddict

unread,
Feb 26, 2007, 11:33:23 AM2/26/07
to
My application, which depends on a native DLL located in C:\WINDOWS,
is running fine in eclipse. However, if I export the jar and then run
it on the command line, I get an UnsatisfiedLinkError on the native
call.

The strange thing is I never told eclipse where to find the DLL (it
just automatically found it WINDOWS), so I can't figure out why the
command line java is not finding it.....

Any ideas?

Thanks,
cpp

Gordon Beaton

unread,
Feb 26, 2007, 12:58:45 PM2/26/07
to
On Mon, 26 Feb 2007 16:33:23 GMT, cppaddict wrote:
> My application, which depends on a native DLL located in C:\WINDOWS,
> is running fine in eclipse. However, if I export the jar and then
> run it on the command line, I get an UnsatisfiedLinkError on the
> native call.

Post the full text of the exception.

I'll assume that C:\WINDOWS is in your PATH...

/gordon

--
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e

cppaddict

unread,
Feb 26, 2007, 3:02:18 PM2/26/07
to
Thanks for the reply, Gordon.

>Post the full text of the exception.

Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: open
at net.sourceforge.jpcap.capture.PacketCapture.open(Native
Method)
at
net.sourceforge.jpcap.capture.PacketCapture.open(PacketCapture.java:6
3)
at network.Sniffer.startSniff(Sniffer.java:132)
at network.Sniffer.run(Sniffer.java:170)
at java.lang.Thread.run(Unknown Source)

>I'll assume that C:\WINDOWS is in your PATH...

Yes, it is.

Gordon Beaton

unread,
Feb 26, 2007, 3:22:21 PM2/26/07
to
On Mon, 26 Feb 2007 20:02:18 GMT, cppaddict wrote:
> Thanks for the reply, Gordon.
>
>>Post the full text of the exception.
>
> Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: open
> at net.sourceforge.jpcap.capture.PacketCapture.open(Native
> Method)
> at
> net.sourceforge.jpcap.capture.PacketCapture.open(PacketCapture.java:6
> 3)
> at network.Sniffer.startSniff(Sniffer.java:132)
> at network.Sniffer.run(Sniffer.java:170)
> at java.lang.Thread.run(Unknown Source)

From the error message it is clear that the DLL was found and
successfully loaded. The error is that it does not appear to contain
the expected method "open".

Have you compiled the DLL or did it come pre-compiled with jpcap?

Use a tool like dumpbin, depends or quickview to display the actual
contents of the DLL. Confirm that it does contain the method, and that
the symbol name has not been mangled by the compiler.

Do you have different versions of the jpcap library installed on your
system?

cppaddict

unread,
Feb 26, 2007, 3:28:46 PM2/26/07
to

>From the error message it is clear that the DLL was found and
>successfully loaded. The error is that it does not appear to contain
>the expected method "open".

I see. But everything is working fine from eclipse... which means
that 2 different DLLs must be getting read, right? Or is there
another explanation?

I verified that C:\WINDOWS is the first folder on my path that
contains a file called "jpcap.dll".

>Do you have different versions of the jpcap library installed on your
>system?

This is possible, and seems the most likely explanation. So how can I
figure out what DLL eclipse is loading, since that is obviously the
correct one?

Thanks for your help,
cpp

cppaddict

unread,
Feb 26, 2007, 4:41:05 PM2/26/07
to
Someone else helped me solve this. Here are the results for
posterity:

The loadLibrary function look in the home directory, in the java
-Djava.library.path variable and in the path.

I have an old version of the DLL in java.library.path.

DOH!

Thanks for your help Gordon.

0 new messages