java.lang.UnsatisfiedLinkError JNetPcap输出错误

时间:2014-11-22 11:58:30

标签: java jnetpcap

运行使用jNetPcap jar的javacode时收到以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J
        at com.slytechs.library.NativeLibrary.dlopen(Native Method)
        at com.slytechs.library.NativeLibrary.<init>(Unknown Source)
        at com.slytechs.library.JNILibrary.<init>(Unknown Source)
        at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
        at com.slytechs.library.JNILibrary.register(Unknown Source)
        at com.slytechs.library.JNILibrary.register(Unknown Source)
        at com.slytechs.library.JNILibrary.register(Unknown Source)
        at org.jnetpcap.Pcap.<clinit>(Unknown Source)
        at PacketExtractor.main(PacketExtractor.java:51)

我想要做的是打开一个.pcap文件,我将要读取或提取一些DNS类型A数据包,为此我准备我的eclipse环境并添加了jNetPcap相关的jar,因为它写在这个网页:http://researchingtech.wordpress.com/2012/10/21/installing-jnetpcap-on-windowseclipse-users/

然后我添加了这部分代码:

        final String FILENAME = "C:\\Users\\Administrator\\Downloads\\dns.cap";  
        final StringBuilder errbuf = new StringBuilder();  

        final Pcap pcap = Pcap.openOffline(FILENAME, errbuf);  
        if (pcap == null) {  
            System.err.println(errbuf); // Error is stored in errbuf if any  
            return;  
        }  

然后,当我编译项目时,我收到了上述错误!

任何人都知道我在我的步骤中错过了什么导致了这个错误?

请告知..

1 个答案:

答案 0 :(得分:1)

当找不到代码正在查找的so / dll文件时,会发生此错误。请确保您已将jnetpcap的.dll文件保存在windows system32文件夹中。