开发者

How to use the Rhino javascript engine in an applet

For my java program I'm using Rhino to execute JS scripts. Now I'm trying to convert it to an applet which works great, except that everytime it's calling evaluateString(...) the JVM throws an AccessControlException. After some (a lot) of research I found out that this is cau开发者_C百科sed by Rhino's custom classloader. My problem is that after hours of googling I still can't find a way to stop Rhino from trying to load it's own classloader.

I hope someone can help me...


It seems to work now. What I did is was set the optimization level to -1 like that:

Context context = Context.enter();
context.setOptimizationLevel(-1);

That causes the whole JS engine to run in interpreter mode and it therefore never tries to create a new classloader.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜