Can I include DLLs and/or .so files in the same JAR file as my application? Will the application be able to call those DLLs or shared objects in the JAR file? If not, then what is the best way to distribute DLLs with my application if I want everything to be included in a single file?
DLLs need to be located by Windows in specific places. Unfortunately, Windows does not look inside of JAR files.
Windows searches for DLLs in the following places:
See Dynamic-Link Library Search Order on MSDN for more information.
- The directory from which the application loaded.
- The system directory.
- The 16-bit system directory.
- The Windows directory.
- The current directory.
- The directories that are listed in the PATH environment variable.
Note that with isCOBOL the directory from which the application loaded is generally the JDK or JRE bin directory containing java.exe. If you execute your application with isrun.exe or iscrun.exe then the directory containing those executables is considered the directory from which the application is loaded.
The best way to distribute DLLs is to include them in a folder with your application and make sure that that folder is the current directory or is in PATH when the application executes.