Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

UnsatisfiedLinkError In Exported Jar But Not In Eclipse

Thread view: 
cppaddict - 26 Feb 2007 16:33 GMT
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 - 26 Feb 2007 17:58 GMT
> 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

Signature

[ 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 - 26 Feb 2007 20:02 GMT
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 - 26 Feb 2007 20:22 GMT
> Thanks for the  reply, Gordon.
>
[quoted text clipped - 9 lines]
>         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?

/gordon

Signature

[ 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 - 26 Feb 2007 20:28 GMT
>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 - 26 Feb 2007 21:41 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.