Browse Prior Art Database

Java to C++

IP.com Disclosure Number: IPCOM000015588D
Original Publication Date: 2002-Apr-25
Included in the Prior Art Database: 2003-Jun-20

Publishing Venue

IBM

Abstract

Java version 1.1 normalizes interactions between virtual machines and DLLs. JNI, the Java Native Interface protocol offers a collection of API allowingaCorC++ program to manipulate directly Java objects. It makes it possible to create new objects, call methods, and read or write attributes. It is also possible to write C or C++ native methods and call them from Java objects. Java's native adjective declares a method as being implemented as a DLL. It will be loaded with the Java class. Java's Virtual Machine will keep the links between native methods and their C/C++ corresponding functions. JNI is essentially a C oriented API. A few syntactical efforts were made for C++, but the integration of these two languages isn't satisfying. There are no equivalents to Java classes in C++, and Java exceptions aren't compatible with C++ exceptions. Here is a C++ example using the JNI protocol to draw a line by calling a method in java.lang.Graphics.