Can't find my own exception class via JNI
- From: pauljlucas.removethis@xxxxxxxxxxxxxxxxxxxxx (Paul J. Lucas)
- Date: Wed, 30 Nov 2005 04:00:01 GMT
Given:
jclass findClassOrDie( JNIEnv *env, char const *name ) {
jclass const theClass = env->FindClass( name );
cerr << "FindClass(" << name << ") failed" << endl;
exit( 1 );
}
void throwMyException( JNIEnv *env, char const *msg ) {
static char const MyExceptionClass[] =
"com/mycompany/utils/MyExceptionClass";
env->ThrowNew( findClassOrDie( env, MyExceptionClass ), msg );
}
Any call to throwMyException() and subsequently to findClassOrDie()
always fails because FindClass() never finds MyExceptionClass, but I
have no idea why not. FindClass works fine for standard Java exception
classes like IllegalArgumentException.
So why can't it find my exception class? It's just a simple class
derived from Exception.
- Paul
.
- Follow-Ups:
- Re: Can't find my own exception class via JNI
- From: Gordon Beaton
- Re: Can't find my own exception class via JNI
- Prev by Date: Rethrowing an exception via JNI ?
- Next by Date: access classes in nested jar
- Previous by thread: Rethrowing an exception via JNI ?
- Next by thread: Re: Can't find my own exception class via JNI
- Index(es):
Relevant Pages
|