简体   繁体   English

加载dll库文件时出现问题... java.lang.UnsatisfiedLinkError:无法加载库

[英]Issue while loading a dll library file… java.lang.UnsatisfiedLinkError: Can't load library

While loading a dll file, I am getting the following exception: 在加载dll文件时,我收到以下异常:

Exception in thread "main" java.lang.UnsatisfiedLinkError:
  D:\Transliteration\rlpnc-3.1.0-sdk-ia32-w32-msvc80\rlp\bin\ia32-w32-msvc80\btrntjni.dll: 
  The system cannot find message text for message number 0x%1 in the message file for %2

at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.basistech.util.internal.Native.loadLibrary(Unknown Source)
at com.basistech.rnt.jni.<clinit>(Unknown Source)
at com.basistech.rnt.RNTEnvironment.<init>(Unknown Source)
at SampleTranslator.<init>(TranslateNameSample.java:88)
at TranslateNameSample.main(TranslateNameSample.java:62)

not sure about the root cause of the issue. 不确定问题的根本原因。 Can anybody help me out in resolving this issue. 任何人都可以帮我解决这个问题。

Thanks, Bhaskar 谢谢,巴斯卡

I work for the company that makes the product you're trying to use. 我为制作您正在尝试使用的产品的公司工作。 We've seen this error when it's been installed against an incompatible version of the underlying layer we ship with it, because of missing dependent DLLs as others have suggested. 我们已经看到这个错误,因为它与我们附带的基础层的不兼容版本一起安装,因为缺少其他人建议的依赖DLL。 Feel free to contact our support team for more help. 请随时联系我们的支持团队以获取更多帮助。

This does not have to do anything with the classpath. 这不需要对类路径做任何事情。 Place the DLL in the current directory, in one of the directories listed in the PATH environment variable, or, best of all, in the native library search path , set using the system property java.library.path: 将DLL放在当前目录中,在PATH环境变量中列出的一个目录中,或者最重要的是,在本机库搜索路径中 ,使用系统属性java.library.path设置:

java -Djava.library.path=C:\MyNativeLibs MyMainClass

As well as checking your are putting the path to the DLL in the correct environment variable you should also check the following: 除了检查您是否在正确的环境变量中放置DLL的路径之外,您还应检查以下内容:

  • The DLL you are loading has all its dependencies satisfied. 您正在加载的DLL具有满足其所有依赖项。 In other words, if this DLL depends on other DLLs, make sure those DLLs can also be found. 换句话说,如果此DLL依赖于其他DLL,请确保也可以找到这些DLL。

  • If the DLL being loaded uses a manifest to specify a specific DLL, ensure that DLL (of the version specified in the manifest) is also on the machine (or in the GAC, if required) and can be found 如果正在加载的DLL使用清单来指定特定的DLL,请确保DLL(清单中指定的版本)也在计算机上(或在GAC中,如果需要)并且可以找到

  • Check that all DLL functions referred in your Java code are correctly defined and exported and export the same datatypes as those your Java code is expecting. 检查Java代码中引用的所有DLL函数是否已正确定义和导出,并导出与Java代码所期望的数据类型相同的数据类型。 This won't stop the DLL loading, but it may well mess up the next stage - resolving link addresses or making functions that should work, fail in unexpected ways. 这不会阻止DLL加载,但它可能会搞砸下一个阶段 - 解析链接地址或使功能正常工作,以意想不到的方式失败。

Lots of fun to be had with this - lots of little things to trip you up. 这有很多乐趣 - 很多小东西可以帮助你。 I had to deal with this a few years back messing with a text to speech package (in C & C++ in a DLL) working with different versions of Java with old and new JNI styles. 几年前我不得不处理这个问题,使用文本到语音包(在DLL中的C&C ++中)处理不同版本的Java以及新旧JNI样式。 What a mess! 真是一团糟!

I have not seen this problem myself, but from the error message it sounds like some dependency needed by the DLL is either missing or incorrect version. 我自己没有看到这个问题,但是从错误消息中可以看出,DLL所需的某些依赖性要么缺失,要么版本不正确。

This tool might help: http://www.dependencywalker.com/ 这个工具可能会有所帮助: http//www.dependencywalker.com/

对我来说,将IDE的dll路径添加到我的IDE中的VM选项。

Check that the "java.library.path" contains the folder containing .dll file. 检查“java.library.path”是否包含包含.dll文件的文件夹。
On windows machine it is related to PATH. 在Windows机器上它与PATH有关。
http://www.inonit.com/cygwin/jni/helloWorld/load.html http://www.inonit.com/cygwin/jni/helloWorld/load.html

暂无
暂无

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

相关问题 Java.lang.UnsatisfiedLinkError: Can't load library when loading mp3 file - Java.lang.UnsatisfiedLinkError: Can't load library when loading mp3 file java.lang.UnsatisfiedLinkError:无法加载库 - java.lang.UnsatisfiedLinkError: Unable to load library 为什么可以找到文件时收到错误“java.lang.UnsatisfiedLinkError:无法加载库”? - Why do I recieve error 'java.lang.UnsatisfiedLinkError: Can't load library' when the file can be found? 线程“main”中的异常 java.lang.UnsatisfiedLinkError - 无法加载库 - 无法获取 InputStream - Exception in thread “main” java.lang.UnsatisfiedLinkError - Unable to load library - Can't obtain InputStream 无法解决错误([-93]无法加载库:java.lang.UnsatisfiedLinkError :) - Can't resolve error ([-93] cannot load library: java.lang.UnsatisfiedLinkError:) java.lang.UnsatisfiedLinkError 在 java.library.path 中没有 *****.dll - java.lang.UnsatisfiedLinkError no *****.dll in java.library.path ghost4j调用ghotscript dll-java.lang.UnsatisfiedLinkError:无法加载库&#39;gsdll32 - ghost4j invoking ghotscript dll - java.lang.UnsatisfiedLinkError: Unable to load library 'gsdll32 java.lang.UnsatisfiedLinkError:由于库未加载,未找到任何实现 - java.lang.UnsatisfiedLinkError: No implementation found due to Library not loading 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 无法加载Xuggle库:java.lang.UnsatisfiedLinkError - Unable to load Xuggle library: java.lang.UnsatisfiedLinkError
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM