Can isCOBOL access a DLL or .so that is in a JAR file?

Question ID : 45
Created on 2009-08-31 at 5:27 PM
Author : Veryant Support [support@veryant.com]

Online URL : http://support.veryant.com/support/phpkb/question.php?ID=45



Question:

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?

Answer:

Windows:
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:
  1. The directory from which the application loaded.
  2. The system directory.
  3. The 16-bit system directory.
  4. The Windows directory.
  5. The current directory.
  6. The directories that are listed in the PATH environment variable.
See Dynamic-Link Library Search Order in Microsoft's documentation for more information.

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.

UNIX/Linux:
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.



Back to Original Question