Let me try to explain my problem.
I have the following directory structure:
Today the DLLs are inside the bin folder and work fine, but due to the requirement I need to go to the ext folder.
When the application starts, I install jna.library.path and java.library.path at runtime:
System.setProperty("jna.library.path", myLibraryPath);
and
final Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths");
usrPathsField.setAccessible(true);
final String[] paths = (String[])usrPathsField.get(null);
for(String path : paths) {
if(path.equals(libraryPath)) {
return;
}
}
final String[] newPaths = Arrays.copyOf(paths, paths.length + 1);
newPaths[newPaths.length-1] = libraryPath;
usrPathsField.set(null, newPaths);
The above code sets java.library.path after initialization.
I tried running it also on the command line:
-Djna.library.path=path_to_ext -Djava.library.path=path_to_ext
So, in my tests, I found that the problem occurs when I call a method from a dll, and this method calls another method of a different dll.
Can someone help me?
Thank you so much
source
share