java.lang.UnsatisfiedLinkError - JNI

前端 未结 3 1965
太阳男子
太阳男子 2021-01-21 18:43

I keep getting a java.lang.UnsatisfiedLinkError error every time I run my program. I have a native, a wrapper, and the program to call the native through the wrapper.<

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-21 19:23

    If you test with

    nativeFile = new File(filename + ".dll");
        if (!nativeFile.exists())
            System.exit(1);
    

    you should use it !!

    System.load(nativeFile);
    

    There are two different ways to load a native library into a running Java program:

    • System.loadLibrary(String) and System.load(String).

    • The System.loadLibrary method allows us to load a library from the "default" path.

      System.loadLibrary("HelloWorld");

    • System.load allows us to load a library from anywhere via its absolute path.
      System.load("c:/path/to/dll/HelloWorld.dll");

提交回复
热议问题