If the DLL is inside the JAR, you will need to copy it to the directory before it can be loaded. (JARs that include their own libraries usually do it themselves.) If your JAR does not, you can use Class.getResourceAsStream () and write it to the directory that you added to java.library.path .
For an example of this, see loadNativeLibrary in JNA. He uses this technique to load his own library (JNI library) from the JAR.
source share