You are here: Rhino project page > Rhino FAQ
var stringArray = java.lang.reflect.Array.newInstance(java.lang.String, 5);
Then if you wish to assign the string "hi" to the first element, simply execute stringArray[0] = "hi".
Creating arrays of primitive types is slightly different: you must use the TYPE field. For example, creating an array of seven ints can be done with the code
var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 7);
Required security context missing
. What's going on?Security.properties
file in your class path at
org.mozilla.javascript.resources
.