Java Native Interface

suggest change

Versions

JNI has been in Java SE since 1.1. The original version list ran through Java SE 9 Early Access.

Parameters

Parameter Details
JNIEnv Pointer to the JNI environment
jobject The object which invoked the non-static native method
jclass The class which invoked the static native method

Remarks

Setting up JNI requires both a Java and a native compiler. Depending on the IDE and OS, there is some setting up required. A guide for Eclipse can be found here. A full tutorial can be found here.

These are the steps for setting up the Java-C++ linkage on Windows:

Calling Java methods from native code requires a method descriptor. If the descriptor is incorrect, a runtime error occurs. javap -s prints the descriptors.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents