java - JpcapCaptor.getDeviceList() returns an empty array -
i'm new jpcap. i'm using
networkinterface[] arr=jpcapcaptor.getdevicelist(); system.out.println(arr.length); to devices jpcap. returns empty array. when print length of array, 0. i' using ubuntu 11.10 , installed libpcap using sudo apt-get install libpcap-dev. have jpcap.jar in classpath. don't understand why i'm not getting network devices. can help me.
edit: when run ifconfig in terminal output.
eth0 link encap:ethernet hwaddr 18:a9:05:cb:8d:fb broadcast multicast mtu:1500 metric:1 rx packets:0 errors:0 dropped:0 overruns:0 frame:0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:0 (0.0 b) tx bytes:0 (0.0 b) interrupt:17
lo link encap:local loopback inet addr:127.0.0.1 mask:255.0.0.0 inet6 addr: ::1/128 scope:host loopback running mtu:16436 metric:1 rx packets:758 errors:0 dropped:0 overruns:0 frame:0 tx packets:758 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 rx bytes:27296 (27.2 kb) tx bytes:27296 (27.2 kb)
wlan0 link encap:ethernet hwaddr 00:26:c6:14:6c:68 inet addr:192.168.2.55 bcast:192.168.3.255 mask:255.255.252.0 inet6 addr: fe80::226:c6ff:fe14:6c68/64 scope:link broadcast running multicast mtu:1500 metric:1 rx packets:11385 errors:0 dropped:0 overruns:0 frame:0 tx packets:6088 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:4582447 (4.5 mb) tx bytes:1203113 (1.2 mb)
i had problem when run in ubuntu 11.10 , netbeans. when seek run jar file using terminal (with sudo permissions) worked. think issue permissions in linux.
running .jar file in terminal sudo java -jar yourjarfile.jar solve issue.
java linux networking network-programming jpcap
No comments:
Post a Comment