首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

求,jna调用动态库,不能正常输出,输出的全是日志,帮帮小弟我

2012-02-01 
求,jna调用动态库,不能正常输出,输出的全是日志,帮帮我各位大哥哥大姐姐们,我这里有一个问题一直没有做出

求,jna调用动态库,不能正常输出,输出的全是日志,帮帮我
各位大哥哥大姐姐们,我这里有一个问题一直没有做出来,请帮帮我,很急,我用的是jna调用动态库,代码是

public interface DMISYSDLL extends StdCallLibrary{
DMISYSDLL INSTANCE=(DMISYSDLL)Native.loadLibrary("SysEnv",DMISYSDLL.class);
public static class FilePathParam extends Structure{
public byte PathBuf;
public byte Discript;
public byte VarDiscript;
public int type;
public static class ByReference extends FilePathParam implements Structure.ByReference{};
public static class ByValue extends FilePathParam implements Structure.ByValue{};
}
public static class DMISYSPARAM extends Structure{
//对应结构类
public NativeLong SysIdentify;
public byte SysIdentifyCode;
public NativeLong LocalIdentify;
public short printtype;
public float SysInertia;
//设备认证编号
public FilePathParam.ByValue DevAttestationNo=new FilePathParam.ByValue();
//监测站名称
public FilePathParam.ByValue StationName=new FilePathParam.ByValue();
//系统审核编号
public FilePathParam.ByValue SysAuditingNo=new FilePathParam.ByValue();
//本地数据源
public FilePathParam.ByValue LocalODBC=new FilePathParam.ByValue();
//远程数据源
public FilePathParam.ByValue RemoteODBC=new FilePathParam.ByValue();
//QA2系统主路径, 非文件
public FilePathParam.ByValue QA2SysPath=new FilePathParam.ByValue();
//QA2系统配置文件主路径, 非文件
public FilePathParam.ByValue QA2CfgPath=new FilePathParam.ByValue();
//QA2系统升级文件路径, 非文件
public FilePathParam.ByValue QA2UpdatePath=new FilePathParam.ByValue();
//QA2系统辅助文件路径, 非文件
public FilePathParam.ByValue QA2AuxPath=new FilePathParam.ByValue();
//下面的描述是制定的文件,非路径
//例如:KFreePrt_TabPath="D:\\QAII\\system\\bin\\prt_freespeed.table"
//打印库路径
//发分仪通讯口
public FilePathParam.ByValue VoicePortPath=new FilePathParam.ByValue();//声级仪通讯口
//
public FilePathParam.ByValue CXKManPath=new FilePathParam.ByValue();//车型库管理库
public FilePathParam.ByValue ParaManPath=new FilePathParam.ByValue();//配置管理工具库
//
public FilePathParam.ByValue LossFilePath=new FilePathParam.ByValue();//public FilePathParam.ByValue BPQFactory=new FilePathParam.ByValue();//变频器/速度转换系数=速度/频率
////////////////////////////////////////
public FilePathParam.ByValue FileResultPath=new FilePathParam.ByValue();//文件联网,结果文件
////////////////////////////////////////
public FilePathParam.ByValue FileNetWorkLibPath=new FilePathParam.ByValue();//文件联网库
////////////////////////////////////////
public FilePathParam.ByValue Res=new FilePathParam.ByValue();//保留
public static class ByReference extends DMISYSPARAM implements Structure.ByReference{};
public static class ByValue extends DMISYSPARAM implements Structure.ByValue{};
}
public int GetSysEnv(DMISYSPARAM.ByReference a);
}

下面是实现代码,
package txxt;


import txxt.DEVHEADDLL.DEV_HEAD;
import txxt.DMISYSDLL.DMISYSPARAM;
import txxt.DMISYSDLL.FilePathParam;


public class TeHpo {

/**
* @param args
* @throws Exception 
*/
public static void main(String[] args) throws Exception {
String sql = "select * from tb_all_result_save where id=?";
Connection conn = BaseDao.getConnection();
PreparedStatement pst = null;
ResultSet rs = null;

pst = conn.prepareStatement(sql);
pst.setInt(1, 11527);
rs = pst.executeQuery();
while(rs.next()){
InputStream in = rs.getBinaryStream("resultinfo");
byte[] buf = new byte[1024 * 150];
in.read(buf);
DEV_HEAD.ByReference devhead = new DEV_HEAD.ByReference();
int n=DEVHEADDLL.INSTANCE.ParseStdHead(buf, devhead);
System.out.println(n+"+++++++++++++");
String IDInfo="";
if(n>0){


DMISYSPARAM.ByReference dmisy=new DMISYSPARAM.ByReference();


  //就是这里出错,,请各位帮帮我,谢谢
int d=DMISYSDLL.INSTANCE.GetSysEnv(dmisy);
System.out.println(d+"==============");
int m=DEVHEADDLL.INSTANCE.GetQA2IDInfo(8003, IDInfo);
System.out.println(m+"------------------");

System.out.println("123");


}

}
}

}
下面是报错代码输出日志
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x2b31e44d, pid=3228, tid=3556
#
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
# Problematic frame:
# C [SysEnv.dll+0xe44d]
#
# An error report file with more information is saved as:
# C:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\ShowFile\hs_err_pid3228.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

[error occurred during error reporting , id 0xc0000005]
我在网上查了一下,不是内存问题就是版本问题,,内存我已经调到2G了,版本,我已经用1.4,1.5,1.6,1.7我都用过了,还是找不到什么原因,请各位大侠们帮帮我,我谢谢你们

[解决办法]
多查查网上,一定有答案

热点排行