Explain Exception handling in JNI.

There are two ways to handle an exception in native code:

-The native method can choose to return immediately, causing the exception to be thrown in the Java code that initiated the native method call.

-The native code can clear the exception by calling ExceptionClear (), and then execute its own exception-handling code. After an exception has been raised, the native code must first clear the exception before making other JNI calls. When there is a pending exception, the only JNI functions that are safe to call are ExceptionOccurred (),ExceptionDescribe (), and ExceptionClear (). The ExceptionDescribe () function prints a debugging message about the pending exception.

Comments

Popular posts from this blog

Bluetooth Data Transfer Example

How to Create & Extract tar.gz and tar.bz2 Files in Linux