I am new to JNI and I am struggling with this problem.
I have a C ++ callback called by the network library (alljoyn).
In this callback, I need to call the Java code.
Since this callback is in a different thread, I use the following code to get the JNIEnv pointer:
(jvm is a global pointer)
JNIEnv *env = NULL; jvm->AttachCurrentThread(&env, NULL);
The problem is that when I try to call FindClass using this env pointer, the result will be NULL.
If I use the same FindClass call in my main thread, everything works fine.
How can i fix this? Is this somehow related to the classpath?
source share