java 用JNA调用DLL异常 5
packageambitui.RobotWindow;importcom.sun.jna.Library;importcom.sun.jna.Native;/****@a...
package ambitui.RobotWindow;
import com.sun.jna.Library;
import com.sun.jna.Native;
/**
*
* @author A0219508
*/
public class niubi {
public interface lihai extends Library{
lihai INSTANCE=(lihai)Native.loadLibrary("niubi",lihai.class);
String Adds(String data);
}
public String add(String data){
return lihai.INSTANCE.Adds(data);
}
public static void main(String[] args) {
niubi li=new niubi();
String str=li.add("11");
System.out.println(str);
}
}
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Adds': ?????????
at com.sun.jna.Function.<init>(Function.java:134)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:345)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:325)
at com.sun.jna.Library$Handler.invoke(Library.java:203)
at sun.proxy.$Proxy0.Adds(Unknown Source)
at ambitui.RobotWindow.niubi.add(niubi.java:24)
at ambitui.RobotWindow.niubi.main(niubi.java:28)
Java Result: 1
windows7 32位系统, JDK 1.6 1.7都试过 用的netbeans软件 展开
import com.sun.jna.Library;
import com.sun.jna.Native;
/**
*
* @author A0219508
*/
public class niubi {
public interface lihai extends Library{
lihai INSTANCE=(lihai)Native.loadLibrary("niubi",lihai.class);
String Adds(String data);
}
public String add(String data){
return lihai.INSTANCE.Adds(data);
}
public static void main(String[] args) {
niubi li=new niubi();
String str=li.add("11");
System.out.println(str);
}
}
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'Adds': ?????????
at com.sun.jna.Function.<init>(Function.java:134)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:345)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:325)
at com.sun.jna.Library$Handler.invoke(Library.java:203)
at sun.proxy.$Proxy0.Adds(Unknown Source)
at ambitui.RobotWindow.niubi.add(niubi.java:24)
at ambitui.RobotWindow.niubi.main(niubi.java:28)
Java Result: 1
windows7 32位系统, JDK 1.6 1.7都试过 用的netbeans软件 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询