Issue while loading a dll library file… java.lang.

2019-04-24 11:35发布

While loading a dll file, I am getting the following exception:

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

6条回答
劫难
2楼-- · 2019-04-24 11:59

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. Feel free to contact our support team for more help.

查看更多
我想做一个坏孩纸
3楼-- · 2019-04-24 12:03

Check that the "java.library.path" contains the folder containing .dll file.
On windows machine it is related to PATH.
http://www.inonit.com/cygwin/jni/helloWorld/load.html

查看更多
不美不萌又怎样
4楼-- · 2019-04-24 12:20

As well as checking your are putting the path to the DLL in the correct environment variable you should also check the following:

  • The DLL you are loading has all its dependencies satisfied. In other words, if this DLL depends on other DLLs, make sure those DLLs can also be found.

  • 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

  • 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. 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.

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. What a mess!

查看更多
闹够了就滚
5楼-- · 2019-04-24 12:22

For me, adding the dll path to the VM options in my IDE worked.

查看更多
Luminary・发光体
6楼-- · 2019-04-24 12:25

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:

java -Djava.library.path=C:\MyNativeLibs MyMainClass
查看更多
太酷不给撩
7楼-- · 2019-04-24 12:25

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.

This tool might help: http://www.dependencywalker.com/

查看更多
登录 后发表回答