The Java Native Interface (JNI)

This chapter describes how to use the Java Native Interface (JNI) with a Java adapter for integration with a C++ application.

There are three basic approaches to enabling an application with a C++ API.

We will discuss the second option, and look at a sample adapter that utilizes this approach.

Note:
This example is intended to show how a Java adapter using JNI might be built, and to show how the sample JNI adapter works. Knowledge of JNI implementation techniques is a prerequisite to understanding and using this approach.

JNI is designed to allow Java applications to call C/C++ libraries. The following example uses Java to call a C++ API. The API is implemented to show how TwineBall, which is a Java adapter, could call a C++ API.

Copyright IBM Corp. 1997, 2003