简体   繁体   中英

Java - Getting a project to run with JPcap

I'm trying to set up a project that uses jpcap in order to detect network traffic. I've tried various ways to get it to work, however every way ends up in errors. I run windows 64 bit, but here's what I've done:

  • Installed winpcap
  • Installed jpcap
  • Copied jpcap.dll to the JRE directory (program files/JRE AND program files (x86)/JRE)
  • Copied jpcap.jar to the JRE directory/lib/ext
  • Copied jpcap.jar to the JDK directory

After doing all that, I add the jpcap.jar to my build path. When I try to compile a simple line, I get the error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: jpcap.JpcapCaptor.getDeviceList()[Ljpcap/NetworkInterface;

In the other version of eclipse, I get a different error, following the same steps:

Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\\Program Files\\Java\\jre7\\bin\\jpcap.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

The line of code I'm using in both cases is:

 list = JpcapCaptor.getDeviceList();

Any help to get this working would be greatly appreciated! Thanks

Yes, you'll have to recompile the DLL for 64-bit. Your only other option is to switch to a 32-bit JVM, or otherwise get some 32-bit process to load the DLL on your behalf and communicate with that process somehow.

extracted from Here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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