Description:
The Java Native Interface (JNI) enables programmers to share data and make function calls between programs written in different languages. A program created in Java can refer to the contents of a program written in C++, and vice versa. The communication also works between Java and C. This book explains how to use the JNI to make Java programs communicate with their neighbors. First things first. As is customary in programming books, the author starts with a "Hello, World" example, except here, the program is written in both C and Java. Gordon walks you through the source code in each language, explains compilation, and quickly gets to the mechanics of using the javah utility to generate an include-able .h file. After the procedural walk-though, Gordon strides into specifics, such as how to get a C/C++ program to set a variable that exists in a Java program and how to deal with native types. He compares object architectures and gets into some detail on arrays, strings, exceptions, and producer-consumer relationships. You'll find plenty of information on input and output, too--the author shows the means of writing to POSIX and Win32 ports. A cool chapter has to do with setting up the Java Developer's Kit as a Windows NT service via the Service Control Manager. A full JNI class reference with minimal annotation ends the book.
|