问题描述
我尝试使用system.load()导入dll。但是它显示了java.lang.UnsatisfiedLinkError的异常:led_data_send.SendColorTp(IIIILjava / lang / String; IIII)I。
i keep在d drive中的dll。所以我将dll的路径指定为d://LEDBAR.dll
i我在dll中调用函数SendColorTp。
代码如下所示
i tried to import dll using system.load().but it showing an exception of java.lang.UnsatisfiedLinkError: led_data_send.SendColorTp(IIIILjava/lang/String;IIII)I.
i kept dll in d drive.so i specified the path of dll to d://LEDBAR.dll
i am calling a function SendColorTp in dll.
code as shown below
private native int SendColorTp(int Port, int Addr, int Mode, int Delay, String Context, int FontSize, int FontColor, int SignWidth, int SignHeight);
static{
System.load("D:\\LEDBAR.dll");
}
推荐答案
package _package;
public class X
{
public native int func(float f, boolean b);
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
我们在_package目录之外运行以下命令:
We run the following commands outside the _package directory:
javac _package/*.java
javah _package.X
运行这些命令后,你会发现一个_package_X.h文件在当前的目录。
After running these commands you will find a _package_X.h file in the current dir.
这篇关于在java中导入extranl dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!