//所有函数返回值: 0表示成功,1表示失败
//开始通讯,
function _bgncom(aCOM:integer):integer
//结束通讯
function _endcom(aCOM:integer):integer
//读取最近的卡号,返回卡号
function _readlast:pchar;stdcall
//设置参数[默认不需要设置]
(用位表示, [bit0] =0: 读到卡号自动发送到焦点处, [bit1]=0 读取后卡号自动清空 )
function _setparam(aParam:integer):integer
dll文档说明是这些写的
求JAVA调用代码
10 个解决方案
#1
我自己写的代码如下:
package ceshi;
public class Duka {
static{
System.loadLibrary("RDCOM");
System.gc();
}
public native Integer bgncom();
public native Integer endcom();
public native String readlast();
public static void main(String[] args) {
System.out.println("------------开始--------------");
Duka dk=new Duka();
Integer i=1;
System.out.println(".....");
i=dk.bgncom();
if(i==1){
System.out.println("连接失败");
return;
}else{
System.out.println("连接成功");
}
String num;
num=dk.readlast();
System.out.println("读卡数:"+num);
}
}
报错如下:
------------开始--------------
.....
Exception in thread "main" java.lang.UnsatisfiedLinkError: ceshi.Duka.bgncom()Ljava/lang/Integer;
at ceshi.Duka.bgncom(Native Method)
at ceshi.Duka.main(Duka.java:18)
package ceshi;
public class Duka {
static{
System.loadLibrary("RDCOM");
System.gc();
}
public native Integer bgncom();
public native Integer endcom();
public native String readlast();
public static void main(String[] args) {
System.out.println("------------开始--------------");
Duka dk=new Duka();
Integer i=1;
System.out.println(".....");
i=dk.bgncom();
if(i==1){
System.out.println("连接失败");
return;
}else{
System.out.println("连接成功");
}
String num;
num=dk.readlast();
System.out.println("读卡数:"+num);
}
}
报错如下:
------------开始--------------
.....
Exception in thread "main" java.lang.UnsatisfiedLinkError: ceshi.Duka.bgncom()Ljava/lang/Integer;
at ceshi.Duka.bgncom(Native Method)
at ceshi.Duka.main(Duka.java:18)
#2
顶啊!!!!
#3
求帮助啊!!
#4
是不是那个dll文件目录不对 没读到
#5
第一个是给我的接口说明文档啊
#6
java.lang.UnsatisfiedLinkError
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
public native Integer bgncom();
jni方式调用dll函数如果楼主列出的是全部的话是不够的,头文件有吗?
还是用jna比较好
http://hi.baidu.com/wei_chou/item/a9a9f3b597245c72244b0955
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
public native Integer bgncom();
jni方式调用dll函数如果楼主列出的是全部的话是不够的,头文件有吗?
还是用jna比较好
http://hi.baidu.com/wei_chou/item/a9a9f3b597245c72244b0955
#7
我想,他应该不是编写c/c++,编译dll的,他只是dll的“用户”。
他应该是dll/so没有放在java.library.path里面
#8
怎么放到java.library.path里面里面
#9
求指教啊!!!!!
#10
救命啊!!!!!!!!!!!!!!!!!!
#1
我自己写的代码如下:
package ceshi;
public class Duka {
static{
System.loadLibrary("RDCOM");
System.gc();
}
public native Integer bgncom();
public native Integer endcom();
public native String readlast();
public static void main(String[] args) {
System.out.println("------------开始--------------");
Duka dk=new Duka();
Integer i=1;
System.out.println(".....");
i=dk.bgncom();
if(i==1){
System.out.println("连接失败");
return;
}else{
System.out.println("连接成功");
}
String num;
num=dk.readlast();
System.out.println("读卡数:"+num);
}
}
报错如下:
------------开始--------------
.....
Exception in thread "main" java.lang.UnsatisfiedLinkError: ceshi.Duka.bgncom()Ljava/lang/Integer;
at ceshi.Duka.bgncom(Native Method)
at ceshi.Duka.main(Duka.java:18)
package ceshi;
public class Duka {
static{
System.loadLibrary("RDCOM");
System.gc();
}
public native Integer bgncom();
public native Integer endcom();
public native String readlast();
public static void main(String[] args) {
System.out.println("------------开始--------------");
Duka dk=new Duka();
Integer i=1;
System.out.println(".....");
i=dk.bgncom();
if(i==1){
System.out.println("连接失败");
return;
}else{
System.out.println("连接成功");
}
String num;
num=dk.readlast();
System.out.println("读卡数:"+num);
}
}
报错如下:
------------开始--------------
.....
Exception in thread "main" java.lang.UnsatisfiedLinkError: ceshi.Duka.bgncom()Ljava/lang/Integer;
at ceshi.Duka.bgncom(Native Method)
at ceshi.Duka.main(Duka.java:18)
#2
顶啊!!!!
#3
求帮助啊!!
#4
是不是那个dll文件目录不对 没读到
#5
第一个是给我的接口说明文档啊
#6
java.lang.UnsatisfiedLinkError
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
public native Integer bgncom();
jni方式调用dll函数如果楼主列出的是全部的话是不够的,头文件有吗?
还是用jna比较好
http://hi.baidu.com/wei_chou/item/a9a9f3b597245c72244b0955
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
public native Integer bgncom();
jni方式调用dll函数如果楼主列出的是全部的话是不够的,头文件有吗?
还是用jna比较好
http://hi.baidu.com/wei_chou/item/a9a9f3b597245c72244b0955
#7
我想,他应该不是编写c/c++,编译dll的,他只是dll的“用户”。
他应该是dll/so没有放在java.library.path里面
#8
怎么放到java.library.path里面里面
#9
求指教啊!!!!!
#10
救命啊!!!!!!!!!!!!!!!!!!