Created On:  24 April 2012

Problem:

A Java program calls a cobol program using CVM.jar.  It gets this java exception:

Initializing logging.
CVM:  begin load
CVM: runtime library successfully loaded.
CVM:  exception caught in constructor
CVM:  Exception caught loading CVM:  null
CVM:  end load Exception caught loading CVM:  null java.lang.NullPointerException
      at com.acucorp.acucobolgt.CVM.getCommandLineArray() (Unknown Source)
      at com.acucorp.acucobolgt.CVM.initialize() (Unknown Source)
      at test.main(java.lang.String[]) (Unknown Source)

Resolution:

Check to make sure the environment is setup correctly, taking care about existing values for previous installations.

For example, this command line was used to setup environment variables:

export CLASSPATH=$CLASSPATH:/usr/acucobol/tools/CVM.jar:.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/acucobol/lib

export PATH=$PATH:/opt/IBMJava2-142/bin:/opt/IBMJava2-142/jre/bin:.:/opt/IBMJava2-142/jre/bin/classic

export JAVA_OPTIONS=-Djava.class.path=/usr/acucobol/tools/CVM.jar:.:

The $PATH and $CLASSPATH environment variables could contain incorrect paths or old setup directories.   
Modifying the command line to point to the current installation first should be done:

export CLASSPATH=/usr/acucobol/tools/CVM.jar:.:$CLASSPATH

export LD_LIBRARY_PATH=/usr/acucobol/lib:$LD_LIBRARY_PATH

export PATH=/opt/IBMJava2-142/bin:/opt/IBMJava2-142/jre/bin:.:/opt/IBMJava2-142/jre/bin/classic:$PATH

export JAVA_OPTIONS=-Djava.class.path=/usr/acucobol/tools/CVM.jar:.:

as the example above shows this is done by putting the exiting environment variable ($variable) at the end of the export statement. 

This makes the new paths load first and solves issues related to the path containing conflicting or incorrect information.

Incident #2260288