Java Native Interface (JNI) is a native programming interface that is part of the Java Software Development Kit (SDK). This interface defines the infrastructure between Java and other languages, such as C and C++, COBOL, PL/I and assembly. It is available on z/OS® for all Language Environment-compliant languages.
JNI provides the solution for two-way communications.

  • It defines a method for Java to invoke native methods.
  • It also defines a method, via a defined API, for native code to invoke Java code. With the defined API, the native code can manipulate Java objects, call Java methods, and share data with Java.

Enterprise COBOL introduced the concept of Object-Oriented (OO) COBOL that simplifies the interactions between Java and COBOL. Using OO COBOL is now the easiest and most convenient way to create OO applications, in particular when crossing the boundary between Java and COBOL is required.

4 comments on"Java Native Interface (JNI)"

  1. Harold Barnes November 03, 2017

    Is there a way for HLASM to call JNI ?

  2. Does calling JAVA affects performance significantly? Say you have the same code in Java and OO COBOL, would using a Java call cost more than calling OO COBOL code?

    • Richard_Tran February 26, 2018

      This will probably depend on what languages you’re calling to and from. If your application can be written purely in any one language whether it’s Java or COBOL, that’s probably the best language to stick to. There will always be some overhead when crossing the language boundary.

      Now supposing you don’t have an option to have everything in a uniform language which happens a lot with legacy code that’s too expensive to be rewritten or purchased code modules, then the question really is what’s the best performing way of crossing the language boundary.

      In that scenario, if you’re crossing the language boundary between Java and COBOL then your best performing solution will most likely always be taking advantage of the JNI interfaces directly. If your goal instead is programming simplicity, then OO COBOL might be better. OO COBOL basically just wrappers (meaning extra overhead) the JNI calls with a simpler interface.

Join The Discussion

Your email address will not be published. Required fields are marked *