Application programming on z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


The Java Native Interface (JNI)

Application programming on z/OS

The Java™ Native Interface (JNI) is the Java interface to native programming languages and is part of the Java Development Kits. If the standard Java APIs do not have the function you need, the JNI allows Java code that runs within a Java Virtual Machine (JVM) to operate with applications and libraries written in other languages, such as PL/I. In addition, the Invocation API allows you to embed a Java Virtual Machine into your native PL/I applications.

Java is a fairly complete programming language; however, there are situations in which you want to call a program written in another programming language. You would do this from Java with a method call to a native language, known as a native method. Programming through the JNI lets you use native methods to do many different operations. A native method can:
  • Use Java objects in the same way that a Java method uses these objects.
  • Create Java objects, including arrays and strings, and then inspect and use these objects to perform its tasks.
  • Inspect and use objects created by Java application code.
  • Update Java objects that it created or were passed to it; these updated objects can then be made available to the Java application.

Lastly, native methods can also easily call already-existing Java methods, capitalizing on the functionality already incorporated in the Java programming framework. In this way, both the native language side and the Java side of an application can create, update, and access Java objects, and then share these objects between them.





Copyright IBM Corporation 1990, 2010