简体   繁体   English

从Java调用c ++ dll

[英]call c++ dll from java

I am using c dll in java, I want to load c Dll in java, I use JNA library but I get error “Exception in thread "main" java.lang.UnsatisfiedLinkError: The application has failed to start because its side-by-side configuration is incorrect.”, please tell me how can I solve my problem, if you have another solution please guidance me. 我在Java中使用c dll,我想在Java中加载c Dll,我使用JNA库,但出现错误“线程“主”中的异常” java.lang.UnsatisfiedLinkError:应用程序无法启动,因为其并排运行。侧面配置不正确。”,请告诉我如何解决我的问题,如果您还有其他解决方案,请指导我。

import com.sun.jna.Native;

public class ConectorTJna {

    public static void main(String args[]) {
        IConectorT lib = (IConectorT) Native.loadLibrary("add", IConectorT.class);
        int teste=lib.add(4, 5);
        System.out.println("RESULT: " + teste);
    }
}

You're probably missing some DLL required by your add.dll . 您可能缺少add.dll所需的某些DLL。 Try to check in the Event viewer -> Windows Logs -> Application to see if there is more info in here. 尝试在事件查看器 -> Windows日志 -> 应用程序中签入,以查看此处是否有更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM