Java Interoperability within the IDE

Native COBOL and Java can interoperate in the following scenarios:

  • A native COBOL program can call a static Java method.
  • A Java program can access (display and set) COBOL working-storage data items marked as shared (this scenario is commonly known as 'Java Shareable').
  • A Java program can call a COBOL program marked as callable (this scenario is commonly known as 'Java Callable').

More information on these scenarios, and details of how data is exchanged between the two languages can be found in Java and non-OO COBOL Interoperability.

To implement any of these scenarios within the IDE, you can decide to store your native COBOL and Java code within the same project, or you can keep the two languages separate, in separate projects within the same workspace.

To interoperate within a single project, use the COBOL/Java Interoperability Project project type. This project type has both a COBOL and a Java nature, which allows both types of source code to build and debug from within the project; no project dependencies need to be maintained between separate COBOL and Java projects.

If you have established COBOL and Java projects already, you may want to leave the code in their separate projects. In which case, as well as the required code adjustments (to call the Java static methods, the COBOL programs, or the shared working-storage items), there are some project-level configurations required to make the two projects interoperate.

COBOL compilation using either method generates a number of Java artifacts that are required to maintain the exchange of data between COBOL and Java data types, and to enable the Java to call COBOL programs. Again, more information on these artifacts can be found in Java and non-OO COBOL Interoperability.