Linux搭建jpcap libpcap环境
高洛峰
高洛峰 2017-04-17 13:14:37
0
2
752

遇到的环境搭建问题,我在安装完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文件

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(2)
左手右手慢动作

Already solved. You need to compile libcap yourself and then compile jpcap to become

巴扎黑

The old version of libpcap only has one libpcap.a file after installation

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!