The InnovationQ application will be updated on Sunday, May 31st from 10am-noon ET. You may experience brief service interruptions during that time.
Browse Prior Art Database

Method to hide JNI plumbing details from programmer

IP.com Disclosure Number: IPCOM000015369D
Original Publication Date: 2001-Dec-19
Included in the Prior Art Database: 2003-Jun-20

Publishing Venue



1. Concept A programming guideline is disclosed that establishes a lightweight framework designed to hide Java Native Interface (JNI) plumbing from the programmer who wants to use Java methods out of an existing C++ environment. This allows to develop or reuse components written in Java and leveraging them from within C++ code without the traditional need to write and test a lot of error-prone and lengthy (1) JNI wrappering code around the Java object, thereby reducing code complexity and improving code maintainability. There exist implementations which solve this problem in a generic way, usually in combination with a code generator or with a metadata repository that mimics some of the capabilities of the Java class reflection interfaces. An example of the first apporach are CORBA implementations that allow to generate Java, C++ or other stubs from an interface file (IDL). If the runtime infrastructure is developed in C++, the Java stubs use JNI functionality "under the covers" but do not allow the end user to use that functionality directly. The lightweight infrastructure presented here hides the details of JNI programming from its user (i.e., the programmer) for many simple and recurrent cases while at the same time allowing to use the full width of JNI functionality for special cases. To achieve this, we provide a C++ base class JniBaseWrapper that the programmer needs to subclass. It includes a set of methods each of which has the signature of one frequently used JNI function with an immutable parameter list, e.g., void JniBaseWrapper::callVoidMethod(