Maison > Questions et réponses > le corps du texte
遇到的环境搭建问题,我在安装完libpcap后,在eclipse中运行测试程序报错,程序及报错如下
package test;
import jpcap.JpcapCaptor;
import jpcap.NetworkInterface;
import jpcap.NetworkInterfaceAddress;
public class test1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
NetworkInterface[] devices = JpcapCaptor.getDeviceList();
System.out.println("usage: java Tcpdump <select a number from the following>");
for (int i = 0; i < devices.length; i++) {
System.out.println(i+" :"+devices[i].name + "(" + devices[i].description+")");
System.out.println(" data link:"+devices[i].datalink_name + "("
+ devices[i].datalink_description+")");
System.out.print(" MAC address:");
for (byte b : devices[i].mac_address)
System.out.print(Integer.toHexString(b&0xff) + ":");
System.out.println();
for (NetworkInterfaceAddress a : devices[i].addresses)
System.out.println(" address:"+a.address + " " + a.subnet + " "
+ a.broadcast);
}
}
}
提示java.lang.UnsatisfiedLinkError: /usr/lib/libjpcap.so: libpcap.so.0.8: 无法打开共享对象文件;没有按个文件或目录。
网上的攻略上是因为没有配链接,链接是在/usr/locate/lib下。
访问该目录,看见libpcap.so.1 但是没有0.8的。这个问题如何解决?老版本的libpcap安装后只有一个libpcap.a文件