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
Using System.loadLibrary("mydll")
works fine, you can also use that one. If you used javah
and you think with your DLL everything is fine, there are two possibilies:
.
and place your DLL in the current working dir.The JVM does not find a DLL your DLL depends on: If you have any dependent libraries in your DLL, they are NOT searched by the JVM, but by Windows itself. And Windows does not know the java.library.path
, so it will look in the system PATH
variable for those. If you have the possibility, you can set the system PATH
variable to the location of your DLLs before starting the JVM and everything will be fine. Or you can load all your DLLs using the JVM like this
System.loadLibrary("dll_1");
System.loadLibrary("dll_2");
System.loadLibrary("dll_3");
where dll_3.dll
depends on dll_2.dll
, which depends on dll_1.dll
.
Hope that helps.
Give the library path in your project as native library location,seems to be solved.
@alee- You can just copy and the paste the dll files in system32 folder of your windows and try to call the library through the System.loadLibrary("mydll")... i guess it may work...