I need to create a two dimensional array of type java.lang.String using the reflection method from JavaScript code which is running inside a java application (inside the rhino scripting engine). This array will be a return value (of a javaScript function) that is used from JavaCode after the function call.
function test() {
var a = java.lang.reflect.Array.newInstance(?, ?);
// fill the array
return a;
}
I couldn't find the right parameters for the newInstance call to create a two diemnsional array of type String.
At the moment I'm working with a workaround, i.e. I create an (outer) array of type java.lang.Objectof size x and inside a x-length loop a create multiple arrays of type java.lang.String each of size y which are assigned to the ''outer' array elements.
Is there an easier way?