Exceptions and javac

Hi,

I have 2 problems with my JNI code:

1 - I created MyException class in Java. And my native method throws this using:

jclass JExpClass = env->FindClass("package/MyException");

if (JExpClass != NULL)

env->ThrowNew (JExpClass, "Example Exception");

env->DeleteLocalRef (JExpClass);

The exception is thrown fine. But the problem comes in catching it:

catch (Exception) //This work OK!

catch (package.MyException) //Exception is not caught!

The class path is fine. Explanations?

2 - The same scenario above. Since MyException extends from Exception, I would expect it to be checked for during compile time. However when I remove the the try and catch clause around the Java code calling the native method, javac does not complain when it should.

What's wrong here?

Thanks.

Dhruv

[887 byte] By [Dhruv_Pandya] at [2007-9-26 6:23:54]
# 1
Presumably you are trying to catch MyException before Exception?And MyException derives from Exception?Does your java native method declaration declare that it throws an Exception?
jschell at 2007-7-1 15:25:45 > top of Java-index,Java HotSpot Virtual Machine,Specifications...