I have Windows 7 (32 bit) installed on my Laptop. I am running the below code on Eclipse Juno :
import jpcap.JpcapCaptor;
import jpcap.NetworkInterface;
public class Network {
public static void main(String[] args) {
NetworkInterface[] devices = JpcapCaptor.getDeviceList();
System.out.println("No. of Network devices : "+devices.length);
}
}
I have 2 network adapters and have administrative privileges
But I get the result as: No. of Network devices : 0
Can someone please help with what could be issue?
Ok. I finally got the answer. Just having the user account with administrative privileges is not enough, I still had to right click on eclipse and select "Run as administrator" and then when I execute the above program, I get the correct no. of network devices
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.