我已经下载了“ jnetpcap-1.4.r1425-1.linux64.x86_64.tgz” dir目录树看起来很像。
jnetpcap-1.4.r1425
â  âââ CHANGE_LOG.txt
â  âââ COPYING
â  âââ COPYING.LESSER
â  âââ include
â  â  âââ analysis.h
â  â  âââ export.h
â  â  âââ jnetpcap_bpf.h
â  â  âââ jnetpcap_dumper.h
â  â  âââ jnetpcap_ids.h
â  â  âââ jnetpcap_utils.h
â  â  âââ mac_addr.h
â  â  âââ nio_jbuffer.h
â  â  âââ nio_jmemory.h
â  â  âââ packet_flow.h
â  â  âââ packet_jscanner.h
â  â  âââ packet_protocol.h
â  â  âââ util_crc16.h
â  â  âââ util_crc32.h
â  â  âââ util_debug.h
â  â  âââ util_in_cksum.h
â  â  âââ winpcap_ext.h
â  â  âââ winpcap_ids.h
â  â  âââ winpcap_stat_ex.h
â  âââ jnetpcap.jar
â  âââ libjnetpcap-pcap100.so
â  âââ libjnetpcap.so
â  âââ RELEASE_NOTES.txt
我将jar放在我的程序执行所在的bin文件夹中,并将其他.so文件和本机文件夹放在其中。
但我仍然得到
java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J
at com.slytechs.library.NativeLibrary.dlopen(Native Method)
at com.slytechs.library.NativeLibrary.<init>(Unknown Source)
at com.slytechs.library.JNILibrary.<init>(Unknown Source)
at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at org.jnetpcap.PcapBpfProgram.<clinit>(Unknown Source)
at pcap.reconst.reconstructor.jnetpcap.PCAPProvider.<init>(PCAPProvider.java:34)
at pcap.reconst.reconstructor.jnetpcap.PcapReconstructor.reconstruct(PcapReconstructor.java:129)
然后我想打开罐子,看看它试图加载什么文件。 我发现
package com.slytechs.library;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@Library(natives={"Kernel"}, jni={"jnetpcap"})
public class NativeLibrary
所以我的问题是它最初尝试加载哪个文件
@Library(natives = {“ Kernel”},jni = {“ jnetpcap ”}})
我怀疑是jnetpcap.so,该文件随软件包一起提供。
在Windows中,我遇到了依赖问题,需要丢失wpcap.dll和packet.dll,因此我将其放置并能够执行。
对于centos,它甚至没有加载库。
如果我做ldd *。*,那么在这里发现了某些依赖性。
[root@ajay-centos jnetpcap-1.4.r1425]# ldd *.*
CHANGE_LOG.txt:
ldd: warning: you do not have execution permission for `./CHANGE_LOG.txt'
not a dynamic executable
COPYING.LESSER:
ldd: warning: you do not have execution permission for `./COPYING.LESSER'
not a dynamic executable
jnetpcap.jar:
ldd: warning: you do not have execution permission for `./jnetpcap.jar'
not a dynamic executable
libjnetpcap-pcap100.so:
ldd: warning: you do not have execution permission for `./libjnetpcap-pcap100.so'
linux-vdso.so.1 => (0x00007ffc7db75000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007ff58fcca000)
libjnetpcap.so => not found
libpcap.so => not found
libc.so.6 => /lib64/libc.so.6 (0x00007ff58f906000)
libm.so.6 => /lib64/libm.so.6 (0x00007ff58f604000)
/lib64/ld-linux-x86-64.so.2 (0x00005612c81b7000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff58f3ed000)
libjnetpcap.so:
ldd: warning: you do not have execution permission for `./libjnetpcap.so'
linux-vdso.so.1 => (0x00007ffd785cb000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fb786ba2000)
libpcap.so => not found
libc.so.6 => /lib64/libc.so.6 (0x00007fb7867de000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb7864dc000)
/lib64/ld-linux-x86-64.so.2 (0x000055d6d5c57000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb7862c6000)
RELEASE_NOTES.txt:
ldd: warning: you do not have execution permission for `./RELEASE_NOTES.txt'
not a dynamic executable.
我看到很多发布的问题,人们说要更改.so文件名等等。
centos中的解决方案是什么? 更具体地说,@Library(natives = {“ Kernel”},jni = {“ jnetpcap”}) 什么是jni = {“ jentpcap”} and natives = {“ Kernel”}