Question

I have tried the following code :

NetworkInterface[] devices = JpcapCaptor.getDeviceList();
    JpcapCaptor jpcap = null;
    System.out.print(devices.length);
    for (int a=0;a<devices.length;a++)
    {
        try
        {
            jpcap = JpcapCaptor.openDevice(devices[a], 2000, true, 20);
            jpcap.loopPacket(-1, new arp_spoofing());//for capture packet
        } 
        catch (IOException ex) 
        {
            Logger.getLogger(Receiver2.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

in same code.when i run in windows,i get some interface but in linux i did'nt get any interface.. there is'nt syntax error..

Was it helpful?

Solution

I had the same problem when I run in Ubuntu 11.10 and netbeans. When I try to run the jar file using the terminal (with sudo permissions) it worked. I think the issue is with permissions in linux.

Try running the .jar file in the terminal sudo java -jar YourJarFile.jar

OTHER TIPS

This is probably Linux not being able to detect the interface, so it won't be available to any Java programs either. What do you get if you run the following command?

sudo ifconfig 

Add that to the question so it's easier to diagnose the issue. There's a related question here, over on Unix/Linux StackExchange:

https://unix.stackexchange.com/questions/48980/cannot-get-realtek-r8168-ethernet-card-up/52451#52451

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top