Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Catching JNI Exceptions

843829Jun 25 2010 — edited Jun 29 2010
Hi all,

So I've been playing with JNI for the last little while. For now it does all I need. One thing though; as I've started implementing error checking in my native code I've noticed that invoking GetMethodID (just an example, happens with allJNI methods as far as I know) with invalid parameters results in an exception being thrown. Everything I'm reading online concerning this subject tells me I should use a combination of ExceptionCheck, ExceptionOccurred and ExceptionClear to handle all that. The problem is that I just can't do that. My thread is throwing an exception, hence it jumps to my "catch(...)" block. I can't seem to figure out what type of object is being thrown so I can't catch it and expose it back to my java code either. And if I don't catch it with (...) the Java VM just dies on me.... not good.

Am I doing something wrong? What is the trick here? I'm must not be setting something important somewhere.

Any help is appreciated.
Thanks

Nic
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 27 2010
Added on Jun 25 2010
7 comments
1,808 views