Friday, April 19, 2013

jni jnienv ExceptionCheck example c c++ java


ExceptionCheck

We introduce a convenience function to check for pending exceptions without creating a local reference to the exception object.
jboolean ExceptionCheck(JNIEnv *env);
Returns JNI_TRUE when there is a pending exception; otherwise, returns JNI_FALSE.
LINKAGE:
Index 228 in the JNIEnv interface function table.
SINCE:
JDK/JRE 1.2

Example - ExceptionCheck


jclass c = env->FindClass("class/does/not/Exist");
if (env->ExceptionCheck()) {
  return;
}
// otherwise do something with 'c'...