java jni c++dll unsatisfiedlinkerror
使用jni,编译的c++的dll,直接编译如下的代码调用"CPlusDll",成功,
class C2JavaInterface
{
public void C2JavaInterface()
{
}
static
{
System.loadLibrary("CPlusDll");
}
// 测试函数
public native void Test();
public native void Test1(int i);
public native void Test2(String str);
public static void main(String ar[])
{
System.out.println(System.getProperty("java.library.path"));
C2JavaInterface Cdll = new C2JavaInterface();
Cdll.Test();
Cdll.Test1(100);
Cdll.Test2("hallo");
}
}
但是使用netbeans建了个桌面应用程序,再调用这个dll就抛异常了(unsatisfiedlinkerror),
执行“Cdll.Test();”这句的时候异常的,
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
C2JavaInterface Cdll = new C2JavaInterface();
Cdll.Test();
Cdll.Test1(100);
Cdll.Test2("hallo");
为毛呢?