java jpcap java.lang.UnsatisfiedLinkError

发布于 2024-11-24 01:35:48 字数 813 浏览 4 评论 0原文

我遇到了 jpcap 和 winpcap 的问题。我以前曾经运行过它,但我不知道现在发生了什么。我已经安装了winpcap并下载了jpcap。第一次运行示例代码时,我收到以下错误。

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)

为了让愿意提供帮助的人更容易,

1)我检查了jpcap.dll在windows下的system32文件夹(我应该检查它是否已注册吗?)

2)jpcap.jar在C:\ WINDOWS \ Sun \下Java\lib\ext。 jpcap已经自动放到这个文件夹下了,我没有选择它。 (但我的java是从C:\Program Files\Java\jdk1.6.0_18运行的)

3)我已经通过eclipse实现了jar文件。

我几乎检查了一切。应该有路径问题或类似的问题。熟悉 jpcap/winpcap 的人可以帮忙吗?

提前致谢..

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..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱的故事 2024-12-01 01:35:48

jpcap.jar 不是 Java 扩展,不应位于 lib/ext 中。它应该位于类路径上的其他位置。该 DLL 不是 Windows 的一部分,也不应该位于 Windows\system32 中:它应该位于 PATH 中的其他位置。 Winpcap 应该安装在任何地方。正如 g051051 所说,检查以前版本的卸载。

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.

寻找我们的幸福 2024-12-01 01:35:48

对我来说,问题在于从 sorcforge 下载 jpcap-0.01.16-win32 附带的 jpcap.dll 版本。我找到了 jpcapSetup-0.7.exe.zip 安装程序,它在 system32 文件夹中安装了正确的 dll。

我的 Windows 机器是 32 位,jvm 32 位,但我仍然遇到 jpcap 问题

我还了解到,如果我将安装程序生成的 dll 复制到另一个目录并卸载该 jpcap 安装程序应用程序,然后将该 dll 放在任何 java_library_path 中,jpcap会起作用的。这意味着 jpcap-0.01.16-win32 下载附带的 dll 是有问题的。

笔记:
确保已安装 Winpcap_4_1_3.exe。如果未安装,您将收到“无法找到依赖库异常”。

确保正确的 jpcap.dll 位于 javapath 环境中的文件夹之一中,或者与程序可执行文件或 program.jar 位于同一目录中。如果没有找到,您将得到“No jpcap in java.library.path”异常。

此处下载 jpcap 安装程序
下载 Winpcap 可以从此处下载

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文