Java calls COBOL demo with ACUCOBOL-GT CVM class on Linux


This article demonstrates the minimum configuration needed to make Java call COBOL using the CVM class on Linux. It also discusses how to overcome an "Exception caught loading CVM: null..." error when performing such a call.


You want to test the interoperability between Java and COBOL using the CVM class on a Linux machine.

Your call fails, and you receive an "Exception caught loading CVM: null..." error.


You need a shared library version 7.0.1 or higher of ACUCOBOL-GT. You will also need a Java JRE version of 1.4.2 or higher.

Accompanying this article is a zipped file containing test.cbl and, which you can use for testing purposes.

  1. Set up PATH, LD_LIBRARY_PATH, and CLASSPATH as environment variables. For example:
    export PATH= /usr1/products/acu/acu720sh-linux/bin:/usr/java/jdk1.5.0_06/bin:$PATH
    export LD_LIBRARY_PATH= /usr1/products/acu/acu720sh-linux/lib:$LD_LIBRARY_PATH
    export CLASSPATH=/usr1/products/acu/acu720sh-linux/tools/CVM.jar:/usr1/test/demo:$CLASSPATH

    Where /usr1/test/demo is the location of test.cbl and, and /usr1/products/acu/acu720sh-linux is the installation location of the ACUCOBOL-GT runtime and compiler.

  2. Compile the test programs using the following commands:
    ccbl -Ga test.cbl
  3. Test the program by entering the following command:
    java test cvm

    The results should appear on the screen.

Exception caught loading errors:

Always put the new paths on each variable at the beginning of the variable, never at the end. If you put them at the end, you risk looking for another version of ACUCOBOL-GT products that may be installed on your machine. This could result in errors such as problems initializing the CVM. This makes the new paths load first and solves issues related to the path containing conflicting or incorrect information.

Incident Number: 2260288

Old KB# 14119
Comment List