Tuesday, 27 August 2013

JNI - java.lang.UnsatisfiedLinkError

JNI - java.lang.UnsatisfiedLinkError

Okay this question may sound rather odd but I really don't see the
difference between this:
File wrapperDll = new
File("C:\\A-PATH\\SibKernel.Server.JavaWrapper.j4n.dll");
and this
File wrapperDll = new
File("C:\\ANOTHER-PATH\\SibKernel.Server.JavaWrapper.j4n.dll");
I use jni4net to access C# written .dll files which use .NET Framework.
Therefore it uses some JNI stuff I sadly don't relly understand since I
don't have any knowledge about JNI.
The .dll file that's been accessed will be loaded by the jni4net framework
like this:
Bridge.setVerbose(true);
Bridge.setClrVersion("v20");
try {
Bridge.init();
Bridge.LoadAndRegisterAssemblyFrom(wrapperDll);
} catch (IOException e) {
e.printStackTrace();
}
Later when I create an object that I want access
sp40 = new SP40Device();
this here either works:
@net.sf.jni4net.attributes.ClrType
public class SP40Device extends system.Object {
//<generated-proxy>
private static system.Type staticType;
protected SP40Device(net.sf.jni4net.inj.INJEnv __env, long __handle) {
super(__env, __handle);
}
@net.sf.jni4net.attributes.ClrConstructor("()V")
public SP40Device() {
super(((net.sf.jni4net.inj.INJEnv)(null)), 0);
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(this);
}
// ...
}
or if I use the other .dll results in this java.lang.UnsatisfiedLinkError:
java.lang.UnsatisfiedLinkError:
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Lnet/sf/jni4net/inj/IClrProxy;)V
at
sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Native
Method)
at sibkernel.server.sp40javawrapper.SP40Device.<init>(SP40Device.java:25)
at sibeclipseplugin.debug.model.SP40Program.<init>(SP40Program.java:46)
at
sibeclipseplugin.debug.model.SibDebugTarget.<init>(SibDebugTarget.java:67)
at
sibeclipseplugin.ui.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:26)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Even though it is the same .dll file that's been opened the one works and
the other doesn't.
Any guess why this problem occurs?

No comments:

Post a Comment