Possible duplicate:Best way to throw exceptions in JNI code?
I see that System # arraycopy can throw ArrayStoreExceptionor IndexOutOfBoundsExceptionetc.But I also noticed that System # arraycopy uses a method native, what does Ccode mean , right?So, how is it possible that the code Ccan raise any of these exceptions java?
ArrayStoreException
IndexOutOfBoundsException
native
C
java
There is no problem to exclude java exception from native code. You can do it easily with code like this:
jclass cls = env->FindClass("java/lang/ArrayStoreException"); env->ThrowNew(cls, message);