Loading DLL in Java - Eclipse - JNI

后端 未结 9 550
北荒
北荒 2020-12-17 18:19

I am trying to load a dll in java using the following code System.loadLibrary(\"mydll\");

The project is placed in D:\\development\\project\\ and i have placed t

9条回答
  •  一生所求
    2020-12-17 18:54

    Where you specify the DLL filename in the library path, omit that. Additionally, your System.loadLibrary call should just be 'mydll'. I can tell you (from experience) that if you put the DLL in the root of your project in Eclipse (i.e., D:\Eclipse Workspace\Proj), it should work. Any further linker errors could be from dependency problems with finding other DLLs. The exception is the same. Use something like Dependency Walker (http://www.dependencywalker.com/) to see if your DLL relies on anything else not on the system library path.

    Edit: UnsatisfiedLinkError: Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native -- it seems like you are using a JNI function which does not exist.

提交回复
热议问题