Can't import sun.org.mozilla.javascript.internal in NetBeans

前端 未结 4 1405
后悔当初
后悔当初 2021-01-06 06:37

In my java program I make heavy use of Suns implmentation of the Rhino script engine. Very recently however, my JDK does not seem to automatically import the rt.jar file any

4条回答
  •  离开以前
    2021-01-06 07:16

    I agree w/ the above advice that you're better off not trying to use the sun internal packages.

    This begs the question, how do you access JavaScript arrays w/out sun.org.mozilla.javascript.internal.NativeArray?

    What worked for me is code as follows. This creates a Java array called vars based off a JavaScript array called vars.

    int varsLength = ((Double)engine.eval("vars.length;")).intValue();
    Object[] vars = new Object[varsLength];
    for(int i=0; i

提交回复
热议问题