I'm currently using the javax.script package for interpreting and executing Javascript code on the fly. Incidentally, this is the same engine used by Mozilla's Rhino JS interpreter.
Question: is there any Java-based Jav开发者_高级运维ascript Engine that is faster than Rhino?
In Java 8, Oracle plan to release Nashorn, which is their own JavaScript engine built into Java. It plans to be much faster than Rhino, and aims to be the reference implementation of JavaScript in Java for the future.
See a recent interview about it with Oracle @ DZone:
If you are happy to use a pre-release JDK, you can download it here.
I haven't heard of any Rhino alternatives. According to this list: http://en.wikipedia.org/wiki/List_of_ECMAScript_engines, Rhino is the only Java-based JavaScript interpeter.
javax.script
is way older (and slightly modified) than the current version of Mozilla's Rhino which you can download from the Internet. Have you tried getting the latest Rhino and using that?
Also depending on for what you're using it and what kind of integration you require, using node.js may be more suitable for you.
精彩评论