I have problem with JNI. I would like to call getter (over JNI) returning two dimensional array and process this array in C/C++.
In Java, I've implemented following class:
package eu.cbridge;
...
public class LDIContainer {
private double[][] doubleData;
...
public double[][] getDoubleData() {
return doubleData;
}
...
}
In the C/C++, following native method has been implemented:
JNIEXPORT void JNICALL Java_eu_cbridge_CWrapper_transferData__Leu_cbridge_LDIContainer
(JNIEnv *env, jobject, jobject) {
//Get class identifier
jclass cls = env->FindClass("eu/cbridge/LDIContainer");
// Get method ID
jmethodID mid = env->GetMethodID(cls, "getDoubleData", "()[[D");
// Call Java method
jobject mvdata = env->CallObjectMethod(cls, mid); // Causes an access violation in C!!!
...
}
Further, I would like to process returned two dimensional array. However, I can access class (cls) and get jmethodID (mid). When I call the method, I get access violation exception :(.
Does anybody know how to get two dimensional array from Java's object by using object's getter?