Using the Java API CVM.jar

Another way to call COBOL from Java is to use the application programming interface (API) contained in the Java archive, "CVM.jar". This interface can be used by Java developers to call COBOL functionality (such as programs and entry points) from their Java class.

Note: This feature is available only to shared library or DLL versions of the ACUCOBOL-GT runtime. On Windows, the DLL version is automatically available. To see if this feature is available to you on UNIX, type ls lib from the ACUCOBOL-GT installation directory. If you see the filename runcbl.so or runcbl.sl, then the feature is available. For instructions on creating a shared library for HPUX 11.0, see Building a Shared Library for HP-UX 11.0.

"CVM.jar" consists of two main classes:

Class Description
CVM  CVM is a singleton class representing the ACUCOBOL-GT runtime. This class allows Java developers to programmatically manage the ACUCOBOL-GT runtime, giving them low-level control of COBOL objects from Java.
CALL_OPTIONS     This options class is used for setting options for each called COBOL program.

Note that you can call COBOL from Java locally or remotely. You can even have the runtime execute remotely without a COBOL object executing on the client. All you need on the client is a Java program and a runtime. For this to work, you set CODE_PREFIX in the configuration file that you provide with the runtime initialization to point to a remote server hosting your COBOL application. The remote server must also be running AcuConnect. AcuConnect is able to execute a COBOL object remotely and share data with the local runtime. For more information on executing remote COBOL programs with AcuConnect, see the AcuConnect User's Guide.