java.lang.UnsatisfiedLinkError JNetPcap output error

2.8k views Asked by At

I received the following error while running my javacode that uses jNetPcap jar :

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)

What i was trying to do is to open a .pcap file that i am going to read or extract some of its DNS type A packets, and for that i prepare my eclipse environment and added jNetPcap related jar, as its written in this web page : http://researchingtech.wordpress.com/2012/10/21/installing-jnetpcap-on-windowseclipse-users/

Then i added this part of code:

        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;  
        }  

Then when i compiled the project i received the aforementioned error !

Any body know what i missed in my steps that caused that error?

Please Advise..

1

There are 1 answers

0
jozef On

this error occurs when the so/dll file that the code is looking for is not found. please ensure you have the .dll file for jnetpcap saved in the windows system32 folder.