Kezumi Miioki
Kezumi Miioki

Reputation: 1

How to check in JNI if java class exists?

If im using this:

if(!env->FindClass("com/test/app")){
    Log("Not found");
    return 0;
}

I got error: no such class

Upvotes: 0

Views: 440

Answers (1)

Michael
Michael

Reputation: 58427

As mentioned in the documentation, FindClass can result in a variety of (Java) exceptions being thrown.

It is an error to make any further JNI calls with a pending Java exception. So you need to, at a minimum, clear the exception using env->ExceptionClear().

Upvotes: 1

Related Questions