Java 2 SDK for Solaris Developer's Guide

Making the Transition From NMI to JNI

NMI is not supported in Java 2 SDK for Solaris software. In some installations, NMI is known as JNI 1.0, and JNI as JNI 1.1.


Note -

Any application containing native methods is platform dependent and not Write Once Run AnywhereTM. This is true regardless of whether NMI or JNI is used. Applets cannot be affected by a change in native method support.


Porting

Porting applications that use NMI to ones that use JNI interfaces is straightforward. For example, an engineer who was unfamiliar with the application ported 6000 lines of C code in approximately two days. In this instance, NMI was only lightly used, but the uses were widely distributed.

javah

The javah command generates C header and source files that are needed to implement native methods. C programs use the generated header and source files to reference instance variables of an object from native source code. JNI does not require header information or stub files. You can still use the javah command with the jni option to generate native method function prototypes needed for JNI-style native methods. The result is placed in the .h file.

In JDK 1.1 default mode, the javah command generates NMI output.

Because the NMI interfaces are completely incompatible with the Java 2 SDK for Solaris implementation, Java 2 SDK for Solaris does not support the production of NMI-style output by way of the -old flag. Rather the -old flag is parsed and, if it is found, an -old not supported message occurs and javah exits.