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 in Microsoft's documentation 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.
The current directory can be either the %ISCOBOL%/bin directory (if you execute your application using a wrapper like isrun.exe or iscrun.exe), or the JDK or JRE bin directory containing java.exe (if you don't use an isCOBOL wrapper).
The best way to distribute DLLs is to include them in a folder with your application and make sure that the folder is the current directory or is in the PATH environment variable when the application executes.
The JVM looks for shared libraries and objects in the directories contained in the library path.
This path is set with a system dependent environment variable.
Similar to the Windows PATH variable, Linux systems look for the LD_LIBRARY_PATH variable, for instance.
You can see a table showing the most common environment variable names in the isCOBOL Evolve manual set.
Browse to the Introduction/The Basics/ isCOBOL and Java/The Library Path.