我需要在java中引用一个.Net dll。我也使用过 jni4net 库。我已按照以下视频中提到的步骤进行操作:
https://www.youtube.com/watch?time_continue=351&v=8OoSK_RWUe4
我已遵循引用 jni4net 库所需的所有步骤,但我得到以下运行时异常:
Exception in thread "main" java.lang.UnsatisfiedLinkError: orionforpython.DynamicOrion.__ctorDynamicOrion0(Lnet/sf/jni4net/inj/IClrProxy;)V
at orionforpython.DynamicOrion.__ctorDynamicOrion0(Native Method)
at orionforpython.DynamicOrion.<init>(DynamicOrion.java:25)
at com.orion.OrionForJava.main(OrionForJava.java:16)
完成所有步骤后,这是我的代码:
package com.orion;
import net.sf.jni4net.Bridge;
import orionforpython.*;
import java.io.*;
class OrionForJava {
public static void main(String[] args) throws IOException {
Bridge.setVerbose(true);
Bridge.init();
File proxyAssemblyFile=new File("OrionForPython.dll");
Bridge.LoadAndRegisterAssemblyFrom(proxyAssemblyFile);
DynamicOrion orion=new DynamicOrion();
String res=orion.ReqLogin("user", "pwd", "");
System.out.print(res);
}}
我尝试使用 NetBeans 8.1 IDE 执行相同的操作,但没有成功。我正在使用 jni4net-0.8.8.0 版本和 Eclipse IDE for Java Developers 版本:Oxygen.3 Release (4.7.3) 任何帮助都会有所帮助!