• Post Reply Bookmark Topic Watch Topic
  • New Topic

net. sourceforge.jpcap. capture. CaptureDeviceOpenException: Error opening adapter

 
Singh Vaibhav
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Jpcap api to capture network packets. I have installed WinPCap on my m/c.
by using following code I m getting the network devices connected to my m/c
String[] devs = PacketCapture. lookupDevices();
the device name i m giving input to

for (int i = 0; i < devs.length; i++) {
try {
System.out.println("\tDevice " + i + " : " + devs[i]);
pcap.open(devs[i], true);
// System.out.println("\n\tgetNetwork : "+pcap.capture(2));
/* pcap.capture(2);
CaptureStatistics c = pcap.getStatistics();
System.out.println( " \n\n\t\tGetRecv Count : "+ c.getReceivedCount());
System.out.println( " \n\n\t\tGetDrop Count : "+ c.getDroppedCount());
*/
} catch (Exception e) {
e.printStackTrace();
}
}

it is giving me exception like

net.sourceforge.jpcap.capture.CaptureDeviceOpenException: Error opening adapter: The system cannot find the device specified. (20)

any one encountered such problem.kindly guide me to solution...
 
Rusty Shackleford
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure your program is running with root or admin privileges.

If that doesn't work, just print out each device in dev and check it against the list in ipconfig.

If neither work, then print the results from the above suggestion and we can go from there.
 
Moeness Baradei
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a reported bug that jpcap 0.0.1.16 can't open network devices on windows XP..
you can find it here.
 
mahmoud adel
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also an eazier thing just shift right click on your jcreator or netbeans when opening and open as admin this will work i had same problem btw and solved it same way
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!