Catching JNI Exceptions
843829Jun 25 2010 — edited Jun 29 2010Hi 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