答案 0 :(得分:0)
我认为这可能对你有用。
JNIEXPORT jint JNICALL Java_demo_JNIWrapper_pax_1store_1get_1data_1avail_1info
(JNIEnv *env, jclass jclass1, jobjectArray jobj){
jclass dataClass=(*env)->FindClass(env,"demo/DataAvailable");//Get the java class
for(i=0;i< 2;i++)
{
jobject j=(*env)->GetObjectArrayElement(env,jobj,i);
jmethodID meth=(*env)->GetMethodID(env,dataClass,"setTimeStamp","(Ljava/lang/String;)V");//this gets the method id present in the class
if(meth==NULL){
printf("Method set is null");
}
jstring x = (*env)->NewStringUTF(env,"2013-12");
(*env)->CallObjectMethod(env,j,meth,x);//This is where I get Null Pointer
}
(*env)->DeleteLocalRef(env, dataClass);
return 0;
}