用Java加Jpcap弄了个抓包的小程序 语法没有问题 但在编译的时候提示
java.lang.UnsatisfiedLinkError: getDeviceList
at jpcap.Jpcap.getDeviceList(Native Method)
at Tcpdump.main(Tcpdump.java:23)
Exception in thread "main"弄不清是什么原因了 代码如下
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import jpcap.*;
import java.io.*;
class Tcpdump implements JpcapHandler
{
public void handlePacket(Packet packet){
System.out.println(packet);
} public static void main(String[] args) throws java.io.IOException{
Jpcap jpcap=null; IPAddress.setAddressConvert(true);
String[] devices=Jpcap.getDeviceList();
for(int i=0;i<devices.length;i++)
System.out.println(devices[i]); if(args.length==1){
jpcap=new Jpcap(args[0],1500,true,200);
}else if(args.length==2 && args[0].equals("-f")){
jpcap=new Jpcap(args[1]);
}else{
System.out.println("Usage: java Tcpdump [device name] | -f [dumpfile]");
System.exit(0);
} jpcap.loopPacket(-1,new Tcpdump());
}
}烦请各位帮忙看看!
java.lang.UnsatisfiedLinkError: getDeviceList
at jpcap.Jpcap.getDeviceList(Native Method)
at Tcpdump.main(Tcpdump.java:23)
Exception in thread "main"弄不清是什么原因了 代码如下
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import jpcap.*;
import java.io.*;
class Tcpdump implements JpcapHandler
{
public void handlePacket(Packet packet){
System.out.println(packet);
} public static void main(String[] args) throws java.io.IOException{
Jpcap jpcap=null; IPAddress.setAddressConvert(true);
String[] devices=Jpcap.getDeviceList();
for(int i=0;i<devices.length;i++)
System.out.println(devices[i]); if(args.length==1){
jpcap=new Jpcap(args[0],1500,true,200);
}else if(args.length==2 && args[0].equals("-f")){
jpcap=new Jpcap(args[1]);
}else{
System.out.println("Usage: java Tcpdump [device name] | -f [dumpfile]");
System.exit(0);
} jpcap.loopPacket(-1,new Tcpdump());
}
}烦请各位帮忙看看!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货