Exception from Native Method doesnt stop the thread

Using System.loadLibrary(), We have loaded the dll from a thread class. The JNI environment is made available in the entire DLL. So In case of any error from DLL, the DLL throws an exception to the calling Java application. The thread does not stop after getting the Exception as the JAVA document says. And also we are not able to kill the thread explicitly.

Though the exception is thrown to Java and caught in Java, the DLL process continues. As a result, both Java application and DLL hang.

Would be grateful if we get a solution soon.

Thanks in advance,

Regards,

Somaundaram.R,

Email : somraj@hotmail.com

[661 byte] By [san121] at [2007-9-26 2:27:39]
# 1

Hi.

I also got that very same problem when creating a library in C with native methods to be called from JAVA. Everytime I raised an Exception the execution continued with the faulty routine blowing up some point ahead.

I sugest you put a return just imediatly after any env->ThrowNew or (*env)->ThrowNew. It solves the problem. At least it did for me.

Hope I've been of some help. :-)

Ric

Lithyum at 2007-6-29 9:42:11 > top of Java-index,Java HotSpot Virtual Machine,Specifications...