I did a straightforward embedding of the Rhino JavaScript interpreter in a KF bundle. It works fine the first few times you interpret a script but then it fails with an internal error:
org.mozilla.javascript.EcmaError: ReferenceError: "java" is not defined. (hello#1)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3162)
at script(hello:1)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1163)
at kf.rhino.bug.Activator$1.run(Activator.java:33)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:280)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:135)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:65)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:142)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:166)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
The exact same code works fine under Equinox. It also works if you morph it into a simple Java application.
I think it's critical that the KF framework be able to handle this because (a) having the ability to script things in a dynamic language is quite useful and (b) the JavaScript interpreter ships as a standard part of Java 6.
I've attached a gzip'd TAR file containing an Eclipse project that reproduces this problem. Due to file size restrictions you'll have to grab js.jar from http://www.mozilla.org/rhino/download.html (I'm working with 1.6R5) to build the project.
Eclipse project that reproduces error