Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NoClassDefFoundError:org/jnetpcap/Pcap_Java_Linux - Fatal编程技术网

java.lang.NoClassDefFoundError:org/jnetpcap/Pcap

java.lang.NoClassDefFoundError:org/jnetpcap/Pcap,java,linux,Java,Linux,import org.jnetpcap.*; List alldevs=new ArrayList();//将充满NIC StringBuilder errbuf=新建StringBuilder();//对于任何错误,请单击msgs int r=Pcap.findAllDevs(alldevs,errbuf); 如果(r==Pcap.NOT|u OK | | alldevs.isEmpty()){ System.err.printf(“无法读取设备列表,错误为”+errbuf.toString(

import org.jnetpcap.*;
List alldevs=new ArrayList();//将充满NIC
StringBuilder errbuf=新建StringBuilder();//对于任何错误,请单击msgs
int r=Pcap.findAllDevs(alldevs,errbuf);
如果(r==Pcap.NOT|u OK | | alldevs.isEmpty()){
System.err.printf(“无法读取设备列表,错误为”+errbuf.toString());
返回;
}
我真的不知道我错过了什么。该文件在Eclipse中工作,但不是通过命令行

添加到运行时类路径。这可能存在于Eclipse中的类路径中,但不存在于当前命令行类路径中

import org.jnetpcap.*;

List<PcapIf> alldevs = new ArrayList<PcapIf>(); // Will be filled with NICs  
StringBuilder errbuf = new StringBuilder();     // For any error msgs  

int r = Pcap.findAllDevs(alldevs, errbuf);  
if (r == Pcap.NOT_OK || alldevs.isEmpty()) {  
    System.err.printf("Can't read list of devices, error is " + errbuf.toString());  
    return;  
}

你能给我看一下你的前几行代码吗?@AlexK Updated,这就是它抱怨的地方!您需要在类路径中拥有jpcap jar文件的完整路径,而不仅仅是它所在的目录。比如说
-cp/home/karl/sslarp/lib/jpcap.jar
sudo java -cp /home/../lib:jnetpcap.jar:. -Djava.libary.path=... sslarp.controller.Controller