0

I am using Netutil class in my simple java app to show all network interfaces, the program code is as follow and the exception result after that. I am absolute beginer and your help is big time saver for me :)

package packet_experience;
import edu.huji.cs.netutils.NetUtilsException;
import edu.huji.cs.netutils.capture.*;
import java.io.IOException;

/**
 *
 * @author Pete
 */
public class Packet_Experience {

    /**
     * @param args the command line arguments
     * @throws edu.huji.cs.netutils.NetUtilsException
     * @throws java.io.IOException
     */
    public static void main(String[] args) throws NetUtilsException, IOException {


        JPCapInterface intArr[] = JPCap.getAllIntefacesNames();
        for (JPCapInterface next : intArr)
        {
            System.out.println(next.toString());
        }

}

run:

Exception in thread "main" java.lang.UnsatisfiedLinkError: edu.huji.cs.netutils.capture.impl.JPCapWraper.get_all_devices(Z)Ljava/lang/String;
at edu.huji.cs.netutils.capture.impl.JPCapWraper.get_all_devices(Native Method)
at edu.huji.cs.netutils.capture.impl.JPCapWraper.getAllInterfaces(JPCapWraper.java:299)
at edu.huji.cs.netutils.capture.JPCap.getAllIntefacesNames(JPCap.java:346)
at packet_experience.Packet_Experience.main(Packet_Experience.java:29)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Update (Solution!):

My CPU is CORE i5 and having Win 7 Home Pre 64bit. I tried JVM 32 and 64bit and changed System_PATH and java.library.path and copied all jar, dll, lib,... files there as well. Also I followed and performed recommendation I received on this page and I read in any other place ( as far as I could understand :) ).

At end I encountered with jnetpcap which has similar performance and I recommend it instead as works perfectly for me. You can find it at jnetpcap Homepage . Note that the same as Netutils you should adjust System_PATH and java.library.path and make sure you use JVM 32bit, otherwise you will definitely receive UnsatisfiedLinkError.

Have fun!

Corey Adler
  • 15,897
  • 18
  • 66
  • 80

1 Answers1

0

The error looks exactly like "You need a dll/so".

Try looking here: NetUtils java library - how to make it work?

You will find the .dll somewhere on Your computer, just search Your windows dir.

Community
  • 1
  • 1
maslan
  • 2,078
  • 16
  • 34
  • Thanks for your reply, I added both netutils.dll and netutils.jar to jre\bin, jre\lib, jdk\bin, and jdk\lib folder and adjusted system path but still the same error shows up. – Pete Radzik Jan 23 '15 at 20:24
  • @PeteRadzik Have You tried checking the java.library.path ? – maslan Jan 25 '15 at 21:12
  • or try to execute it with this parameter: -Djava.library.path= – maslan Jan 25 '15 at 21:14
  • Highly appreciate for your comments, Yes I checked java.library.path and I the netutils.dll is already there, even also I added libnet.lib to the path as well. But unfortunately the same result. I continue "Trial and Error" all ideas to find my fault. – Pete Radzik Jan 26 '15 at 17:57