JIntegra:java com bridgehttp://www.linar.com/

解决方案 »

  1.   

    建议先封装成dll,再从java中load那个类库,调用其中的方法就可以了。
    例子:
    package msgbus;public class EBCallMsgBus
    {
      public static void main(String[] args)
      {
        //Load dll library first.
        System.loadLibrary("MsgBus");//MsgBus.dll
        EBCallMsgBus EBCallMsgBus1 = new EBCallMsgBus();
        
        String send_id = "UC";
        String send_app = "XX";
        String resv_id = "LIFE";
        String resv_app = "021";
        String body = "9999";
        String msg_id = "";
        String rtn_cd = "";    String[] strRetrun = {"",""};
        System.out.println("java start!");
        
        try {
        System.out.println(System.getProperty("user.dir"));
        strRetrun = EBCallMsgBus1.MsgBusPut(send_id,send_app,resv_id,resv_app,body);
        System.out.println("MsgBusPut: [" + strRetrun[0] + "] " + "[" + strRetrun[1] + "]");    if(strRetrun[1].equals("0000"))
        {
         msg_id = strRetrun[0];
    body="";
         rtn_cd="";
         strRetrun = EBCallMsgBus1.MsgBusGet(send_id,send_app,resv_id,resv_app,msg_id);
    System.out.println("MsgBusGet: [" + strRetrun[0] + "] " + "[" + strRetrun[1] + "]");
        }    } catch (Throwable e) {
         e.printStackTrace();
        }
      }
      public native String[] MsgBusGet(
       String send_id,
                   String send_app,
                   String resv_id,
                   String resv_app,
                   String body);
      public native String[] MsgBusPut(
       String send_id,
                   String send_app,
                   String resv_id,
                   String resv_app,
                   String msg_id);
    }
      

  2.   

    用Jacob,开放源代码的,在google上搜,
    我也正在学习中,互相帮助。
      

  3.   

    Java Tutorial里面Java Native Interface中介绍得很详细了。