Compiling OO applications

When you compile OO applications, use the cob2_j command to compile COBOL client programs and class definitions, and the javac command to compile Java class definitions to produce bytecode (suffix .class).

When you compile using the cob2_j command, the THREAD compiler option is automatically included as a default invocation option, and the Java Native Interface (JNI) libraries are included in the list of libraries passed to the linker. (You might need to update the libraries, however, for the release level of Java that you are using. For details, see the related concept about JDK support and the related task about modifying the default compiler configuration.)

A COBOL source file that contains a class definition must not contain any other class or program definitions.

When you compile a COBOL class definition, two output files are generated:

If a COBOL client program or class definition includes the file JNI.cpy by using a COPY statement, specify the include subdirectory of the COBOL install directory (typically /usr/lpp/cobol/include) in the search order for copybooks. You can specify the include subdirectory by using the -I option of the cob2_j command or by setting the SYSLIB environment variable.

related concepts  
JDK support