JNI: How can i check if jobject is a null object in native c code

RahulMohan82 picture RahulMohan82 · Feb 27, 2010 · Viewed 22k times · Source

JNI: How can i check if jobject is a null object in native c code

Answer

David Sauter picture David Sauter · Mar 2, 2010

Since the objects in Java and C code actually use the same memory locations (the object passed to the native code is the same memory reference in both worlds), a simple

if (someJObject == NULL) {}

in the C code should be just fine I guess. I haven't tested it though :-)