简体   繁体   English

加载本机库时出现UnsatisfiedLinkError

[英]UnsatisfiedLinkError while loading native library

I'm trying to use native library from my java program. 我正在尝试使用Java程序中的本机库。 I can successfully load libpHash.so in /usr/local/lib by the following command. 我可以通过以下命令在/usr/local/lib成功加载libpHash.so

System.loadLibrary("pHash");

But when I trying to load libpHash-jni.so in the same folder by calling System.loadLibrary("pHash-jni") I get the following error: 但是,当我尝试通过调用System.loadLibrary("pHash-jni")在同一文件夹中加载libpHash-jni.so ,出现以下错误:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/lib/libpHash-jni.so: libpHash.so.0: cannot open shared object file: No such file or directory 线程“主”中的异常java.lang.UnsatisfiedLinkError:/usr/local/lib/libpHash-jni.so:libpHash.so.0:无法打开共享对象文件:没有这样的文件或目录

Why? 为什么?


Some additional information: 一些其他信息:

  • libpHash.so and libpHash.so.0 are both symbolic links to libpHash.so.0.0.0 libpHash.solibpHash.so.0都是符号链接libpHash.so.0.0.0
  • libpHash.so.0.0.0 and libpHash-jni.so are both ELF 64-bit LSB shared object libpHash.so.0.0.0libpHash-jni.so都是ELF 64位LSB共享对象
  • I have 64 bit JVM 我有64位JVM

One possible solution is updating the dynamic linker cache with ldconfig . 一种可能的解决方案是使用ldconfig更新动态链接器缓存。 If this doesn't solve the problem you might also try setting LD_LIBRARY_PATH 如果这样不能解决问题,您也可以尝试设置LD_LIBRARY_PATH

export LD_LIBRARY_PATH=/usr/local/lib

and restart your program. 并重新启动程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 访问本机方法时出现UnsatisfiedLinkError - UnsatisfiedLinkError while accessing a Native method 加载dll库文件时出现问题... java.lang.UnsatisfiedLinkError:无法加载库 - Issue while loading a dll library file… java.lang.UnsatisfiedLinkError: Can't load library 在Android应用程序上加载现有共享库(.so)时出错(找不到unsatisfiedlinkerror本机方法) - Error loading existing shared library (.so) on Android app (unsatisfiedlinkerror native method not found) java.lang.UnsatisfiedLinkError:加载gnu.io.RXTXCommDriver时在java.library.path中没有抛出rxtxSerial - java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver 在MATLAB中从Java加载库时出现UnsatisfiedLinkError - UnsatisfiedLinkError When Loading a Library from Java in MATLAB Android java.lang.UnsatisfiedLinkError与本机库 - Android java.lang.UnsatisfiedLinkError with native library Windows,JNA:无法加载本机库-UnsatisfiedLinkError - Windows, JNA: Cannot load native library - UnsatisfiedLinkError 找不到android项目中的本机库(UnsatisfiedLinkError) - Native library in android project not found (UnsatisfiedLinkError) UnsatisfiedLinkError:找不到本地库“ wcepeer”(Mysaifu) - UnsatisfiedLinkError : Native library 'wcepeer' not found (Mysaifu) Jython UnsatisfiedLinkError对共享库中的本机方法调用 - Jython UnsatisfiedLinkError on native method invocation in shared library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM