JNI dependent libraries

后端 未结 6 538
小鲜肉
小鲜肉 2020-12-31 03:52

I\'m running a library via JNI (I didn\'t write it), and internally it calls another DLL. I get an error saying \"Can\'t find dependent libraries\" unless I put the path of

6条回答
  •  滥情空心
    2020-12-31 04:13

    This helped me a lot. Also managed loading a JNI dll built using cygwin:

    first:

    /* conditioned if OS is windows because also need it to work in Linux env. */ 
    System.loadLibrary("cygwin1"); 
    

    then:

    System.loadLibrary("mylib"); 
    

    On windows, This requires either setting the java.library.path to match both libraries locations.

    If runnning from Eclipse, this setting may be replaced by "Native Libraries Location" in java build path (in JRE libraries settings).

    However, still finding this a bit tricky.

提交回复
热议问题