求助Jnative使用问题
正在学着使用Jnative调用DLL文件
代码如下:
import org.xvolks.jnative.JNative;
import org.xvolks.jnative.Type;
import org.xvolks.jnative.exceptions.NativeException;
import org.xvolks.jnative.pointers.memory.GlobalMemoryBlock;
import org.xvolks.jnative.pointers.memory.MemoryBlockFactory;
public class Jnative {
public static void main(String[] args) throws NoSuchMethodException {
JNative n = null;
try {
n = new JNative("Jnative2", "add");
n.setRetVal(Type.INT);
n.invoke();
String res = n.getRetVal();
System.out.println(res);
} catch (Exception e1) {
e1.printStackTrace();
}
finally{
if (n != null) {
try {
n.dispose();
} catch (NativeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
报错:
org.xvolks.jnative.exceptions.NativeException: Function add not found
at org.xvolks.jnative.JNative.nLoadLibrary(Native Method)
at org.xvolks.jnative.JNative.loadLibrary(JNative.java:534)
at org.xvolks.jnative.JNative.<init>(JNative.java:510)
at org.xvolks.jnative.JNative.<init>(JNative.java:427)
at Jnative.main(Jnative.java:16)
说是找不到类库和方法?用绝对路径指定Jnative2也不行,请哪位高手指定一下!!