运行后报错#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b118f63, pid=3272, tid=5812
#
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
# Problematic frame:
# C  [EQ2008_Dll.dll+0x58f63]
#
# An error report file with more information is saved as:
# E:\Workspaces\MyEclipse8.6\DoDll\hs_err_pid3272.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.
#日志中的信息:#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b118f63, pid=3272, tid=5812
#
# Java VM: Java HotSpot(TM) Client VM (11.3-b02 mixed mode windows-x86)
# Problematic frame:
# C  [EQ2008_Dll.dll+0x58f63]
#
# 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.
#---------------  T H R E A D  ---------------Current thread (0x00846c00):  JavaThread "main" [_thread_in_native, id=5812, stack(0x008e0000,0x00930000)]siginfo: ExceptionCode=0xc0000005, reading address 0x00000000Registers:
EAX=0x0092f618, EBX=0x00000000, ECX=0x00000000, EDX=0x7efefeff
ESP=0x0092f510, EBP=0x0092f5f0, ESI=0x00000000, EDI=0x0092f578
EIP=0x0b118f63, EFLAGS=0x00010246Top of Stack: (sp=0x0092f510)
0x0092f510:   0092f880 0b0c7feb 0092f578 00000000
0x0092f520:   7c9301e0 ffffffff 7c9301db 0b119d5c
0x0092f530:   0b310000 00000000 00000004 0092f880
0x0092f540:   1e101b31 00000000 0092f558 0185000f
0x0092f550:   00000004 00000000 0092f570 00000010
0x0092f560:   00000007 00000000 00000000 000002bc
0x0092f570:   8600d000 22020201 74737953 00006d65
0x0092f580:   0b31bb10 0092f5b4 0b0f3eed 0092f684 Instructions: (pc=0x0b118f63)
0x0b118f53:   00 00 75 ea eb 05 89 17 83 c7 04 ba ff fe fe 7e
0x0b118f63:   8b 01 03 d0 83 f0 ff 33 c2 8b 11 83 c1 04 a9 00 
Stack: [0x008e0000,0x00930000],  sp=0x0092f510,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [EQ2008_Dll.dll+0x58f63]
C  [EQ2008_Dll.dll+0x1bcc4]
C  [EQ2008_Dll.dll+0x1d613]
C  [jna6882708038020435887.dll+0xcb77]
C  [jna6882708038020435887.dll+0xc7c2]
C  [jna6882708038020435887.dll+0x4561]
C  [jna6882708038020435887.dll+0x4d2e]
j  com.sun.jna.Function.invokeInt(I[Ljava/lang/Object;)I+0
j  com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;Z)Ljava/lang/Object;+315
j  com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+214
j  com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+341
j  $Proxy0.User_AddSingleText(ILuser/DoDll$Dll$User_SingleText;I)I+30
j  user.DoDll.Dodll(ILjava/lang/String;I)I+312
j  user.DoDll.DoAll(ZILjava/lang/String;I)Z+42
j  user.DoDll.main([Ljava/lang/String;)V+12
v  ~StubRoutines::call_stubJava frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.sun.jna.Function.invokeInt(I[Ljava/lang/Object;)I+0
j  com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;Z)Ljava/lang/Object;+315
j  com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;+214
j  com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+341
j  $Proxy0.User_AddSingleText(ILuser/DoDll$Dll$User_SingleText;I)I+30
j  user.DoDll.Dodll(ILjava/lang/String;I)I+312
j  user.DoDll.DoAll(ZILjava/lang/String;I)Z+42
j  user.DoDll.main([Ljava/lang/String;)V+12
v  ~StubRoutines::call_stub---------------  P R O C E S S  ---------------Java Threads: ( => current thread )
  0x0ab19c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4224, stack(0x0ad60000,0x0adb0000)]
  0x0ab0e800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3088, stack(0x0ad10000,0x0ad60000)]
  0x0ab3b400 JavaThread "Attach Listener" daemon [_thread_blocked, id=3560, stack(0x0acc0000,0x0ad10000)]
  0x0ab26400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=772, stack(0x0ac70000,0x0acc0000)]
  0x0aafc800 JavaThread "Finalizer" daemon [_thread_blocked, id=5964, stack(0x0ac20000,0x0ac70000)]
  0x0aaf8000 JavaThread "Reference Handler" daemon [_thread_blocked, id=5144, stack(0x0abd0000,0x0ac20000)]
=>0x00846c00 JavaThread "main" [_thread_in_native, id=5812, stack(0x008e0000,0x00930000)]Other Threads:
  0x0aaf4800 VMThread [stack: 0x0ab80000,0x0abd0000] [id=3632]
  0x0ab1b800 WatcherThread [stack: 0x0adb0000,0x0ae00000] [id=4568]VM state:not at safepoint (normal execution)VM Mutex/Monitor currently owned by a thread: NoneHeap
 def new generation   total 960K, used 231K [0x029e0000, 0x02ae0000, 0x02ec0000)
  eden space 896K,  20% used [0x029e0000, 0x02a0d860, 0x02ac0000)
  from space 64K,  77% used [0x02ac0000, 0x02acc750, 0x02ad0000)
  to   space 64K,   0% used [0x02ad0000, 0x02ad0000, 0x02ae0000)
 tenured generation   total 4096K, used 230K [0x02ec0000, 0x032c0000, 0x069e0000)
   the space 4096K,   5% used [0x02ec0000, 0x02ef9ba0, 0x02ef9c00, 0x032c0000)
 compacting perm gen  total 12288K, used 3494K [0x069e0000, 0x075e0000, 0x0a9e0000)
   the space 12288K,  28% used [0x069e0000, 0x06d49880, 0x06d49a00, 0x075e0000)
No shared spaces configured.Dynamic libraries:
0x00400000 - 0x00424000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin\javaw.exe
0x7c920000 - 0x7c9b6000  C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c91e000  C:\WINDOWS\system32\kernel32.dll
0x77da0000 - 0x77e49000  C:\WINDOWS\system32\ADVAPI32.dll
0x77e50000 - 0x77ee3000  C:\WINDOWS\system32\RPCRT4.dll
0x77fc0000 - 0x77fd1000  C:\WINDOWS\system32\Secur32.dll
0x77d10000 - 0x77da0000  C:\WINDOWS\system32\USER32.dll
0x77ef0000 - 0x77f39000  C:\WINDOWS\system32\GDI32.dll
0x76300000 - 0x7631d000  C:\WINDOWS\system32\IMM32.DLL
0x62c20000 - 0x62c29000  C:\WINDOWS\system32\LPK.DLL
0x73fa0000 - 0x7400b000  C:\WINDOWS\system32\USP10.dll
0x7c340000 - 0x7c396000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\msvcr71.dll
0x6d8b0000 - 0x6db06000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\client\jvm.dll
0x76b10000 - 0x76b3a000  C:\WINDOWS\system32\WINMM.dll
0x6d340000 - 0x6d348000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\hpi.dll
0x76bc0000 - 0x76bcb000  C:\WINDOWS\system32\PSAPI.DLL
0x6d860000 - 0x6d86c000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\verify.dll
0x6d3e0000 - 0x6d3ff000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\java.dll
0x6d8a0000 - 0x6d8af000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\zip.dll
0x68000000 - 0x68036000  C:\WINDOWS\system32\rsaenh.dll
0x77be0000 - 0x77c38000  C:\WINDOWS\system32\msvcrt.dll
0x759d0000 - 0x75a7f000  C:\WINDOWS\system32\USERENV.dll
0x5fdd0000 - 0x5fe25000  C:\WINDOWS\system32\netapi32.dll
0x6d6c0000 - 0x6d6d3000  D:\program files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\jre\bin\net.dll
0x71a20000 - 0x71a37000  C:\WINDOWS\system32\WS2_32.dll
0x71a10000 - 0x71a18000  C:\WINDOWS\system32\WS2HELP.dll
0x719c0000 - 0x719fe000  C:\WINDOWS\System32\mswsock.dll
0x76ef0000 - 0x76f17000  C:\WINDOWS\system32\DNSAPI.dll
0x76d30000 - 0x76d48000  C:\WINDOWS\system32\iphlpapi.dll
0x76f80000 - 0x76f88000  C:\WINDOWS\System32\winrnr.dll
0x76f30000 - 0x76f5c000  C:\WINDOWS\system32\WLDAP32.dll
0x76f90000 - 0x76f96000  C:\WINDOWS\system32\rasadhlp.dll
0x10000000 - 0x10055000  C:\Documents and Settings\qy\Local Settings\Temp\jna6882708038020435887.dll
0x0b0c0000 - 0x0b17c000  E:\Workspaces\MyEclipse8.6\DoDll\EQ2008_Dll.dll
0x77180000 - 0x77283000  C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
0x77f40000 - 0x77fb6000  C:\WINDOWS\system32\SHLWAPI.dll
0x76990000 - 0x76ace000  C:\WINDOWS\system32\ole32.dll
0x770f0000 - 0x7717b000  C:\WINDOWS\system32\OLEAUT32.dll
0x61880000 - 0x618ba000  C:\WINDOWS\system32\OLEACC.dll
0x72f70000 - 0x72f96000  C:\WINDOWS\system32\WINSPOOL.DRV
0x76320000 - 0x76367000  C:\WINDOWS\system32\COMDLG32.dll
0x7d590000 - 0x7dd84000  C:\WINDOWS\system32\SHELL32.dll
0x49010000 - 0x49096000  C:\WINDOWS\system32\msftedit.dll
0x74d90000 - 0x74dfd000  C:\WINDOWS\system32\Riched20.dllVM Arguments:
jvm_args: -Dfile.encoding=GBK 
java_command: user.DoDll
Launcher Type: SUN_STANDARDEnvironment Variables:
CLASSPATH=.;JAVA_HOME\lib\dt.jar;JAVA_HOME\lib\tools.jar
PATH=D:/program files/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin/client;D:/program files/Genuitec/Common/binary/com.sun.java.jdk.win32.x86_1.6.0.013/jre/bin;E:\oracle\product\10.2.0\db_1\bin;JAVA_HOME\bin;C:\Program Files\Java\jdk1.6.0\bin
USERNAME=qy
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 10, GenuineIntel---------------  S Y S T E M  ---------------OS: Windows XP Build 2600 Service Pack 3CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 7 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3Memory: 4k page, physical 1958696k(872168k free), swap 3898024k(2693208k free)vm_info: Java HotSpot(TM) Client VM (11.3-b02) for windows-x86 JRE (1.6.0_13-b03), built on Mar  9 2009 01:15:24 by "java_re" with MS VC++ 7.1time: Sat Jun 22 11:57:37 2013
elapsed time: 0 secondsjnadllchar*

解决方案 »

  1.   

    dll中的结构体:1、§窗体设置
    typedef struct 
    {
     int   iX;     //窗口的起点X
     int   iY;     //窗口的起点Y
     int   iWidth;    //窗体的宽度
     int   iHeight;       //窗体的高度
     int   iFrameMode;   //边框的样式
     COLORREF FrameColor;   //边框颜色
    }User_PartInfo;
    2、§字体设置
    typedef struct 
    {
     char*  strFontName;      //字体的名称
     int   iFontSize;   //字体的大小
     BOOL  bFontBold;   //字体是否加粗
     BOOL  bFontItaic;   //字体是否是斜体
     BOOL  bFontUnderline;  //字体是否带下划线
     COLORREF colorFont;   //字体的颜色
     int   iAlignStyle;      //对齐方式
                  //0-左对齐
                  //1-居中
                  //2-右对齐
     int         iVAlignerStyle;      //上下对齐方式
               //0-顶对齐
               //1-上下居中
               //2-底对齐
     int         iRowSpace;   //行间距
    }User_FontSet;
    3、§动画方式设置
    typedef struct _User_MoveSet
    {
     int   iActionType;      //节目变换方式
     int   iActionSpeed;      //节目的播放速度 
     BOOL  bClear;    //是否需要清除背景
     int   iHoldTime;   //在屏幕上停留的时间
     int          iClearSpeed;      //清除显示屏的速度
     int   iClearActionType;     //节目清除的变换方式
     int          iFrameTime;       //每帧时间
    }User_MoveSet;
    4、§单行文本区参数
    typedef struct _User_SingleText
    {
     char    *chContent           //显示内容
     User_PartInfo  PartInfo;          //分区信息
     COLORREF  BkColor;       //背景颜色
     User_FontSet  FontInfo;         //字体设置
     User_MoveSet  MoveSet;       //动作方式设置
    }User_SingleText;dll中要调用的方法:int User_AddProgram(int CardNum,BOOL bWaitToEnd,int iPlayTime);
    函数功能:添加节目索引
    参数说明:CardNum  - 控制卡地址,基数为1,即第一块控制卡地址为1
        bWaitToEnd  - TRUE 等待节目播放完成再播放下个节目
    FALSE节目播放时间为iPlayTime
    iPlayTime   - 节目播放时间,单位为秒
    返回值: 节目索引号int User_AddSingleText(int CardNum,User_SingleText *pSingleText,int iProgramIndex);
    函数功能:添加单行文本区
    参数说明:CardNum   - 控制卡地址,基数为1,即第一块控制卡地址为1
    pSingleText - 单行文本参数表指针,参考【参数表】中8 
    iProgramIndex - 节目索引号
    返回值:  -1-添加单行文本区失败,非-1-分区编号java中用jna模拟结构体package pushData;import com.sun.jna.Structure;public class User_FontSet extends Structure{
     public String strFontName="text";
     public int iFontSize=2;
     public boolean bFontBold=true;
     public boolean bFontItaic=true;
     public boolean bFontUnderline=true;
     public long colorFont=1;
     public int iAlignStyle=1;
     public int iVAlignerStyle=1;
     public int iRowSpace=1;
    public static class ByReference extends User_FontSet implements Structure.ByReference { }public static class ByValue extends User_FontSet implements Structure.ByValue{}
     }
    package pushData;import com.sun.jna.Structure;public class User_MoveSet extends Structure{

     public int iActionType=1;
     public int iActionSpeed=1;
     public boolean bClear=false;
     public int iHoldTime=1;
     public int iClearSpeed=1;
     public int iClearActionType=1;
     public int iFrameTime=1;

    public static class ByReference extends User_MoveSet implements Structure.ByReference { } public static class ByValue extends User_MoveSet implements Structure.ByValue{} }package pushData;import com.sun.jna.Structure;public class User_PartInfo extends Structure{
     public int iX=50;
     public int iY=50;
     public int iWidth=30;
     public int iHeight=20;
     public int iFrameMode=1;
     public long FrameColor=1;
    public static class ByReference extends User_PartInfo implements Structure.ByReference { } public static class ByValue extends User_PartInfo implements Structure.ByValue{}
    }package pushData;import com.sun.jna.Structure;public class User_SingleText extends Structure{
     public String chContent;
         public User_PartInfo.ByValue up;
         public long BKColor;
         public User_FontSet.ByValue ub;
         public User_MoveSet.ByValue um; public static class ByReference extends User_SingleText implements Structure.ByReference { }public static class ByValue extends User_SingleText implements Structure.ByValue{ }} 
      

  2.   

    ava中调用dll和调用dll的方法
    package pushData;
    import com.sun.jna.Native;
    import com.sun.jna.win32.StdCallLibrary;public class DoDll {


    public interface Dll extends StdCallLibrary{


    Dll INSTANCE = (Dll) Native.loadLibrary("EQ2008_Dll", Dll.class);//加载dll文件


    public boolean User_DelAllProgram(int CardNum);//删除一个节目
    public int User_AddProgram(int CardNum,boolean bWaitToEnd,int iPlayTime);//添加节目 public int  User_AddSingleText(int CardNum,User_SingleText pSingleText,int iProgramIndex);//添加单行文本区
    public boolean User_SendToScreen (int iCardNum);//发送节目数据到控制卡
    }



    //删除一个节目
    private boolean User_DelAllProgram(int CardNum)
    {
    return Dll.INSTANCE.User_DelAllProgram(CardNum);
    }


    //添加节目
    private int User_AddProgram(int CardNum,boolean bWaitToEnd,int iPlayTime)
    {
    return  Dll.INSTANCE.User_AddProgram(CardNum,bWaitToEnd,iPlayTime);
    }


    //添加单行文本区
    private int Dodll(int CardNum,String chContents,int iProgramIndex){
    User_SingleText us1=new User_SingleText.ByReference();
    us1.chContent=chContents;

    us1.up=new User_PartInfo.ByValue();

    us1.up.iX=1;
    us1.up.iY=2;
    us1.up.iWidth=1;
    us1.up.iHeight=2;
    us1.up.iFrameMode=1;
    us1.up.FrameColor=0;
    us1.up.write();

    us1.BKColor=1;

    us1.ub= new User_FontSet.ByValue();
    us1.ub.strFontName="text";
    us1.ub.iFontSize=1;
    us1.ub.bFontBold=false;
    us1.ub.bFontItaic=false;
    us1.ub.bFontUnderline=false;
    us1.ub.colorFont=1;
    us1.ub.iAlignStyle=1;
    us1.ub.iVAlignerStyle=1;
    us1.ub.iRowSpace=2;
    us1.ub.write();

    us1.um=new User_MoveSet.ByValue();
    us1.um.iActionType=1;
    us1.um.iActionSpeed=2;
    us1.um.bClear=false;
    us1.um.iHoldTime=2;
    us1.um.iClearSpeed=1;
    us1.um.iClearActionType=2;
    us1.um.iFrameTime=2;
    us1.um.write();

    us1.write();

    return Dll.INSTANCE.User_AddSingleText(CardNum,us1,iProgramIndex);
    }

    //发送节目数据到控制卡
    private boolean User_SendToScreen (int CardNum)
    {
    return Dll.INSTANCE.User_SendToScreen(CardNum);
    }
    private int[] CardNums=new int[]{0,1,2,3,4,5,6,7,8,9};

    public boolean DoAll(boolean bWaitToEnd,int iPlayTime,String  chContents, int iProgramIndex)
    {
    boolean rd=false;
    for(int i=0;i<CardNums.length;i++)
    {

    int rn=User_AddProgram(CardNums[i],bWaitToEnd,iPlayTime);

    int rs=Dodll(CardNums[i],chContents,rn);
    if(rs!=-1)
    {

    rd=true;

    }

    }
    return rd;
    }
    }
      

  3.   

    尽可能详细,希望大牛们给些建议
    自己判断是java模拟结构体中User_SingleText的 char* chContent 时报错,因为我在Java文件中将这个属性注销,运行就没问题了,自己试了试网上查到的方法,指针和byte【】都不行,顺便提一下c的编码是ascii
      

  4.   

    不要用这种类型的,要改成通用型的。 unicode这种编码好像。
      

  5.   


    我用的jnative调用EQ2008_Dll.dll,也把那个ini文件和dll放在一起了,为什么连基本的关屏,开屏都调不通啊,不报错,就是返回false,lz留个联系方式白,沟通下
      

  6.   


    我用的jnative调用EQ2008_Dll.dll,也把那个ini文件和dll放在一起了,为什么连基本的关屏,开屏都调不通啊,不报错,就是返回false,lz留个联系方式白,沟通下
    我用的是jna,开平和关平我倒是没用到。开屏关屏调试应该是先把大屏配置好了,还有你那个ini文件的控制卡地址也配置好,这样才能测。你不报错就应该是调用成功了
      

  7.   

    这个我以前做过声音板卡,用了java的桥接包jnative.jar,每个java参数都会对应一个c对应的参数名哇,你这好像么看到啊,桥接方法(java调c的方法)你没贴出来吧
      

  8.   

    贴了,jna调用不用每次声明参数分配内存什么的,但是参数也要和c对应,我现在别的方法都是调通了就是添加USER_SingleText的时候总是返回的是-1,也就是没添加成功。我看了这个添加不用和硬件相连。自己判断还是参数对应的问题,一个是char*一个是机构体中的指针
      

  9.   

    public static final void ssmGetLastErrMsg(String errMsg)
    throws NativeException,IllegalAccessException
    {
    JNative n = null;
    try
    {
    n = new JNative("SHP_A3.dll","SsmGetLastErrMsg");
    //n.setRetVal(Type.INT);
    //int i = 0;
    n.setParameter(0,Type.STRING,errMsg);
    n.invoke();
    //return n.getRetVal();
    }
    catch (NativeException e) 
    {
    e.printStackTrace();

    catch (IllegalAccessException e)
    {
    e.printStackTrace();
    }
    //return Integer.parseInt(n.getRetVal());

    }
    这个是我以前做的你看看吧
      

  10.   

    哎最后java还是没解决,用了.net
      

  11.   

    哥们你在调dll里面函数的时候unsigned char *转换成的java里什么类型,byte行不通。