Hi,
I'm getting an
ArrayStoreException when trying to send an
Array of Arrays of Strings from C to Java with JNI:
jtags[Array1, Array2, ...] (up to three arrays)
Array1[String1, String2, ...] (up to three strings)
Both the
jtags array and the arrays inside have a maximum size of 3 elements.
I create an Array of Strings like this:
for(j = 0; j < szFound; j++) {
(...)
// Creates a Java string array
arrayTemp = (*env)->NewObjectArray(env, sizeTmp, strCls, NULL);
for (i = 0; i < sizeTmp; i++) {
// Transforms a string into a Java string
strTemp = (*env)->NewStringUTF(env, tagsTmp);
// Adds Java string to a Java string array
(*env)->SetObjectArrayElement(env, arrayTemp, i, strTemp);
}
(...)
}I them add these Arrays of Strings to jtags:
for(j = 0; j < szFound; j++) {
(...)
// Adds a Java string array to the final matrix
(*env)->SetObjectArrayElement(env, jtags, j, arrayTemp);
(...)
} Hope this is the correct way of doing this.
In Java I read jtags like:
public String[][] tags() {
String tags[][] = nativeTagID();
return tags;
}
(...)
public native String[][] nativeTagID();I've tried replacing String tags[][] = nativeTagID(); with String[][] tags = nativeTagID().clone();, with no success.
Any help would be great, don't know what else do to.
Edited by: Rorsch on Mar 22, 2010 1:26 PM
Edited by: Rorsch on Mar 22, 2010 2:22 PM