Reputation: 61
I load C++ JNI DLL on my Java project. It works quietly good on JDK 1.6 but there is a probelm JDK 1.8. Is there any change in C++ JNI DLL loading in Java 1.8?
I have attached errors and result below.
JDK 1.8 Console :
Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\ws-pidion\PidionSDK\oojnidotnet.dll: Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at JavaCallNative.<clinit>(JavaCallNative.java:14)
Codes:
File readReturnNativeStringVaueFile;
static {
System.loadLibrary("oojnidotnet");
}
protected void finalize() throws Throwable {
super.finalize();
}
public native boolean connect(String paramString);
Same codes work with JDK 1.6.
Thanks.
Upvotes: 1
Views: 1499
Reputation: 61
I solved this problem with user2543253s helping.
For JDK 1.8:
Need 2 DLL Lib (C:\Program Files (x86)\Java\jdk1.6.0_45\jre\bin\plugin2) (2 DLL libs copy to project path. )
System.loadLibrary("msvcr71");
System.loadLibrary("npjp2");
System.loadLibrary("oojnidotnet");
It works this way in 1.8.
Thanks.
Upvotes: 1