如何将多维sun.org.mozilla.javascript.internal.NativeArray转换为相应的多维Java数组?
var verA=4;
var verB= [1234.000000,456.000000,7899.000000,14200.000000];
var arrayC= [
[
["tmp/a111"],
["tmp/a222.png","tmp/a333.png"],
["tmp/a444","tmp/a555.png","tmp/a666.png","tmp/a777.png"]],
[
["tmp/b111.png"],
["tmp/b222","tmp/b333.png"],
["tmp/b444.png","tmp/b555.png","tmp/b666.png","tmp/b777.png"]]};
我可以转换verA但很难转换verB和arraC这里是我的代码。
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("JavaScript");
scriptEngine.eval(javaScriptStringAbove);
Bindings bindings = scriptEngine.getBindings(ScriptContext.ENGINE_SCOPE);
System.out.println(bindings.keySet());// prints the ver names
Double verA = ((Double)bindings.get("verA")); // this works fine
Object verB[] = ((Object[])bindings.get("verB")); //error
Object verB[][][] = ((Object[])bindings.get("arrayC")); //error
我收到此错误
java.lang.ClassCastException:sun.org.mozilla.javascript.internal.NativeArray无法强制转换为[Ljava.lang.Object;