Tip: When calling COBOL from Java, you should enable the
A_PRESERVE_SIGNAL_HANDLERS configuration variable to ensure intended behavior.
With ACUCOBOL-GT, there are many ways to achieve interoperability with Java. If you want to call COBOL from a Java application,
you can:
- Use ACUCOBOL-GT's Java compiler options to generate Java classes that call your ACUCOBOL-GT program. Java programmers can
then invoke these classes as they would any native Java code.
- Use the Java native interface, "CVM.jar", to interact with the COBOL program at the API level. "CVM.jar" contains a singleton
class, CVM, that encapsulates the ACUCOBOL-GT runtime. With the CVM, the Java programmer can programmatically instantiate
an instance of the ACUCOBOL-GT runtime and invoke a COBOL program. The programmer can use other classes or methods of CVM
to specify runtime options and program options.
- Use the C$SOCKET library routine to facilitate interprocess communication via sockets. C$SOCKET is a low-level option, but
it is very flexible.
- Use our CGI extensions. The Java programmer can use CGI to call a remote COBOL procedure through a Web server.
- Use the Java Native Interface (JNI) to call the ACUCOBOL-GT runtime dynamic link library (DLL) in Windows or shared library
in UNIX.
- Use named pipes to pass data between your COBOL and Java applications if they reside on the same host machine. Passing data
through named pipes is a low-level solution requiring the development of C code. Named pipes are a good option for legacy
applications that perform strictly file I/O.
- Use AcuXDBC™ to access COBOL Vision data from a Java Database Connectivity (JDBC)-enabled application.