我使用 jni4net 并创建了一个 j4n.dll 和一个 j4n.jar。当我尝试使用新按钮实例化对象时,eclipse 会理解导入,就像ISslTcpClient sslTcpClient = new SslTcpClient();
我收到如下错误一样:
线程“main”中的异常 java.lang.UnsatisfiedLinkError: firstdata.icvtnsclient.SslTcpClient.__ctorSslTcpClient0(Lnet/sf/jni4net/inj/IClrProxy;)V at firstdata.icvtnsclient.SslTcpClient.__ctorSslTcpClient0(Native Method) at firstdata.icvtnsclient.SslTcpClient .(SslTcpClient.java:25) 在 program.JNI4NETexample.main(JNI4NETexample.java:46)
为什么我会收到此错误?提前谢谢你的帮助。
以下是附加信息:
我将我的 J4n.jar 添加到构建路径中,并将所有 dll 文件以及根文件夹中的 jar 文件添加到源代码之前。
这里是代码: SslTcpClient sslTcpClient=new SslTcpClient(); 是给我带来困难的线。
package program ;
import net.sf.jni4net.Bridge;
import java.io.File;
import java.io.IOException;
import java.lang.String;
import system.Console;
import system.collections.IDictionary;
import system.collections.IEnumerator;
import system.io.TextWriter;
import firstdata.icvtnsclient.ISslTcpClient;
import firstdata.icvtnsclient.SslTcpClient;
/*import system.*;
import system.Object;
import system.io.TextWriter;
import system.collections.IDictionary;
import system.collections.IEnumerator; */
//This example is from the JNI4net example
public class JNI4NETexample implements ISslTcpClient {
// {System.loadLibrary("ICVTnsClient.j4n");} //do not use .dll for loadlibrary
public static void main(String[] args) throws IOException {
// create bridge, with default setup
// it will lookup jni4net.n.dll next to jni4net.j.jar
try {
Bridge.setVerbose(true);
Bridge.init();
// Bridge.LoadAndRegisterAssemblyFrom(new File("ICVTnsClient.dll"));
Bridge.LoadAndRegisterAssemblyFrom(new File("ICVTnsClient.j4n.dll"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SslTcpClient sslTcpClient=new SslTcpClient();
String csEncryptedString = sslTcpClient.Encrypt("C1 2005 151601 4111111111111111 0703 84.00");
System.out.println("THIS IS THE ASNWER "+ "csEncryptedString");
}
public String Decrypt(String arg0) {
// TODO Auto-generated method stub
return null;
}
public String Encrypt(String arg0) {
// TODO Auto-generated method stub
return null;
}
}