简体   繁体   中英

java jpcap java.lang.UnsatisfiedLinkError

I have got a problem with jpcap and winpcap. I used to run it before but I do not know what is happening now. I have installed winpcap and downloaded jpcap. On the first run of the example code, I got the following error.

PacketCapture: loading native library jpcap.. ok
Exception in thread "main" java.lang.UnsatisfiedLinkError: net.sourceforge.jpcap.capture.PacketCapture.findDevice()Ljava/lang/String;
    at net.sourceforge.jpcap.capture.PacketCapture.findDevice(Native Method)
    at com.oz.test.Example1.<init>(Example1.java:38)
    at com.oz.test.Example1.main(Example1.java:55)

To make this easier to the ones who is willing to help,

1) I checked jpcap.dll is under windows, system32 folder (should I check if it is registered?)

2) jpcap.jar is under C:\WINDOWS\Sun\Java\lib\ext. jpcap has put it under this folder automatically, I did not choose it. (but my java is running from C:\Program Files\Java\jdk1.6.0_18)

3) I have implemented the jar file through eclipse.

I have pretty much checked everything. There should be a path issue or something similar. Can anybody please help who is familiar with jpcap/winpcap?

Thanks in advance..

For me the problem was with the version of jpcap.dll that came with jpcap-0.01.16-win32 download from sorceforge. I found a jpcapSetup-0.7.exe.zip installer which installed the right dll in system32 folder.

My windows machine was 32bit, jvm 32bit but i was still geting issues with jpcap

I also learnt that if i copied that dll produced by the installer to another directory and uninstall that jpcap installer app,and then place that dll in any java_library_path would, jpcap will work. which means the dll that comes with jpcap-0.01.16-win32 download is the one with the problem.

Note: Make sure Winpcap_4_1_3.exe is installed. If not installed you will get a "Cant find dependent libraries exception".

Make sure the right jpcap.dll is in one of folders on javapath enviroment or is in the same directory as your program excutable or program.jar. If its not found, you will get "No jpcap in java.library.path" exception.

Download jpcap installer here Download Winpcap can be downloaded from here

jpcap.jar is not a Java extension and should not be in lib/ext. It should be somewhere else on your classpath. The DLL is not part of Windows and shouldn't be in Windows\system32: it should he somewhere else in your PATH. Winpcap should go wherever it installs to. And as g051051 says, check uninstalls of prior versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM