in Rhino, can I enumerate the list of available Java packages? How?
问题 I tried doing this: var r = {}; for (p in Packages) { if (Packages.hasOwnProperty(p)) { r[p] = p.toString(); } } ...But I got an error: TypeError: Invalid iterator value ... at line xx The line indicated in the error message is the one with for (p in Packages) { ... } Also, var r = { "Packages" : typeof Packages, "Packages.length" : typeof Packages.length, "Packages.java" : typeof Packages.java, "Packages.surelyThisIsNotDefined" : typeof Packages.surelyThisIsNotDefined }; results in: {