我使用了jni4net并创建了一个j4n.dll和一个j4n.jar。当我尝试使用像ISslTcpClient sslTcpClient = new SslTcpClient();
这样的新按钮实例化对象时,eclipse了解导入我得到如下错误:
线程“main”中的异常java.lang.UnsatisfiedLinkError:firstdata.icvtnsclient.SslTcpClient .__ ctorSslTcpClient0(Lnet / sf / jni4net / inj / IClrProxy;)V at firstdata.icvtnsclient.SslTcpClient .__ ctorSslTcpClient0(Native Method) 在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;
}
}