简体   繁体   English

Jpcap软件包中的JpcapCaptor,NetworkInterface

[英]JpcapCaptor, NetworkInterface in Jpcap package

I have dowloaded a jpcap package from http://sourceforge.net/projects/jpcap/ I have copied the jar file in ext of jre and jdk and also copied the folder in bin of jdk. 我从http://sourceforge.net/projects/jpcap/下载了一个jpcap程序包。我已经将jar文件复制到了jre和jdk的ext目录中,还将该文件夹复制到了jdk的bin中。 but when i run my code it shows a error of JpcapCaptor and Network Interface class not found. 但是,当我运行我的代码时,它显示JpcapCaptor的错误,并且找不到网络接口类。

I have also searched manually in my package and there is no class named JpcapCaptor. 我也在包中手动搜索过,并且没有名为JpcapCaptor的类。 Please help me if i had installed a wrong package or what? 如果我安装了错误的软件包或什么,请帮助我。

yes there is no class named JpcapCaptor in 0.01.16 version. 是的,在0.01.16版本中没有名为JpcapCaptor的类。 and your problem about the network interface not found is because PacketCapture.getDevice is adding \\n and other string (like window) to the device name, which make it unreadable when you are trying to open the device so try compare the device name with the one you can find by using ipconfig in the Command prompt and erase the extra string using substring. 找不到您的网络接口的问题是因为PacketCapture.getDevice在设备名称中添加了\\ n和其他字符串(例如window),这在您尝试打开设备时使它不可读,因此请尝试将设备名称与您可以通过在命令提示符下使用ipconfig找到一个,然后使用子字符串删除多余的字符串。 you can use code when you open the device: 您可以在打开设备时使用代码:

     PacketCapture pcap=new PacketCapture();
     String device=pcap.findDevice();
     device=device.substring(0, device.indexOf("}")+1);
     m_pcap.open(device, true);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM