日期:2014-05-20  浏览次数:20891 次

Java 抓包 运行错误
初学Java 根据资料写一个Java抓包程序
(参考http://blog.csdn.net/guanchanghui/archive/2007/09/22/1796390.aspx)
拷贝到Eclipse运行,报错了:


Exception in thread "main" java.lang.UnsatisfiedLinkError: jpcap.JpcapCaptor.getDeviceList()[Ljpcap/NetworkInterface;
at jpcap.JpcapCaptor.getDeviceList(Native Method)
at netcap.Jcapturedialog.<init>(Jcapturedialog.java:136)
at netcap.Jcapturedialog.main(Jcapturedialog.java:109)

错误发生在 devices = JpcapCaptor.getDeviceList();
但不知道怎么改,上边的参考网站的文章在最后说是网卡选择的问题,我也不知道怎么选择。
请各位帮帮忙吧
------最佳解决方案--------------------
devices = JpcapCaptor.getDeviceList();
                                          if(devices == null){
                                                 JOptionPane.showMessageDialog(frame, "没有找到网卡");
                                                 dispose();
                                                 return;
                                          }
                                          else{
                                                 String[] names = new String[devices.length];
                                                 for(int i=0;i < names.length;i++){
                                                        names[i] = (devices[i].description == null?devices[i].name:devices[i].description);
                                                 }
                                                 netJComboBox = new JComboBox(names);