The JavaTM platform is relatively new, which means there could
be times when you will need to integrate programs written with the Java
language with existing non-Java language services, API toolkits, and
programs. The Java platform provides the Java Native Interface (JNI) to
help ease this type of integration.
The JNI defines a standard naming and calling convention so the
Java1 virtual machine can locate and invoke native methods.
In fact, JNI is built into the Java virtual machine so the Java
virtual machine can invoke
local system calls to perform input and output, graphics, networking, and threading
operations on the host operating system.
This chapter explains how to use JNI in programs written in the Java
language to call any libraries on the local machine, call Java language
methods from inside native code, and how to create and run a Java VM instance.
To show how you can put JNI to use, the examples in this chapter include
integrating JNI with the Xbase C++ database API, and how you can call a
mathematic function.
Xbase
has sources you can download.
In a Rush?
This table links you directly to specific topics.
Topic |
Section |
JNI Example |
|
Strings, Arrays, and Fields |
|
Other Programming Issues |
|
_______
1 As used on this web site,
the terms "Java virtual
machine" or "JVM" mean a virtual machine
for the Java platform.
[TOP]