简体   繁体   English

java jpcap java.lang.UnsatisfiedLinkError

[英]java jpcap java.lang.UnsatisfiedLinkError

I have got a problem with jpcap and winpcap.我遇到了 jpcap 和 winpcap 的问题。 I used to run it before but I do not know what is happening now.我以前曾经运行过它,但我不知道现在发生了什么。 I have installed winpcap and downloaded jpcap.我已经安装了winpcap并下载了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?) 1)我检查了 jpcap.dll 在 windows, system32 文件夹下(我应该检查它是否已注册?)

2) jpcap.jar is under C:\WINDOWS\Sun\Java\lib\ext. 2) jpcap.jar 在 C:\WINDOWS\Sun\Java\lib\ext 下。 jpcap has put it under this folder automatically, I did not choose it. jpcap已经自动放到这个文件夹下了,我没选。 (but my java is running from C:\Program Files\Java\jdk1.6.0_18) (但我的 java 从 C:\Program Files\Java\jdk1.6.0_18 运行)

3) I have implemented the jar file through eclipse. 3)我已经通过eclipse实现了jar文件。

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?任何人都可以帮助熟悉 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.对我来说,问题出在从 sorceforge 下载的 jpcap-0.01.16-win32 附带的 jpcap.dll 版本上。 I found a jpcapSetup-0.7.exe.zip installer which installed the right dll in system32 folder.我找到了一个 jpcapSetup-0.7.exe.zip 安装程序,它在 system32 文件夹中安装了正确的 dll。

My windows machine was 32bit, jvm 32bit but i was still geting issues with jpcap我的 windows 机器是 32 位的,jvm 是 32 位的,但我仍然遇到 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.我还了解到,如果我将安装程序生成的 dll 复制到另一个目录并卸载该 jpcap 安装程序应用程序,然后将 dll 放在任何 java_library_path 中,jpcap 将起作用。 which means the dll that comes with jpcap-0.01.16-win32 download is the one with the problem.这意味着 jpcap-0.01.16-win32 下载附带的 dll 是有问题的。

Note: Make sure Winpcap_4_1_3.exe is installed.注意:确保已安装 Winpcap_4_1_3.exe。 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.确保正确的 jpcap.dll 位于 javapath 环境中的文件夹之一中,或者与您的程序可执行文件或 program.jar 位于同一目录中。 If its not found, you will get "No jpcap in java.library.path" exception.如果未找到,您将收到“java.library.path 中没有 jpcap”异常。

Download jpcap installer here Download Winpcap can be downloaded from here此处下载 jpcap 安装程序 可以从此处下载Winpcap

jpcap.jar is not a Java extension and should not be in lib/ext. jpcap.jar 不是 Java 扩展,不应在 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. DLL 不是 Windows 的一部分,不应该在 Windows\system32 中:它应该在你的路径中的其他地方。 Winpcap should go wherever it installs to. Winpcap 应该 go 安装到任何位置。 And as g051051 says, check uninstalls of prior versions.正如 g051051 所说,检查以前版本的卸载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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