java调用dll

代码如下:

package com.tt;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import webService.AuthenticationPT;
import webService.DataSyncWS;

import javax.xml.ws.Holder;

public class Main {

    public static void main(String[] args) {
        try {
            AuthenticationPT authenticationPT = new AuthenticationPT();
            authenticationPT.setUserCode("xxx");
            authenticationPT.setPassword("xxx");
            String verify = "xxx";
            DataSyncWS dataSyncWS = new DataSyncWS();
            Holder<byte[]> result = new Holder<>();
            Holder<String> message = new Holder<>();
            dataSyncWS.getDataSyncWSSoap().getSyncData(verify, authenticationPT, result, message);
            byte[] value = result.value;
            String DLL_NAME = "EncryptionLibrary64.EncryptionLibraryCom";
            ActiveXComponent activeXComponent = new ActiveXComponent(DLL_NAME);
            Variant variant = (Dispatch.call(activeXComponent, "_7UnZipAndFromUTF8", value));
            System.out.println(variant.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

需要jar包:jacob.jar

 

posted @ 2020-05-07 16:23  木木少  阅读(269)  评论(0)    收藏  举报