Can code throw java exceptions?

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?

+5
source share
1 answer

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);
+3
source

All Articles