Java 6 内置版本的 Rhino 和直接来自 Mozilla 的 Rhino 包有什么区别?
我知道 API 非常不同,但是内置 JavaScript 内容和可从 Mozilla 获得的 Rhino 版本之间有功能差异吗?
I know the APIs are very different, but is there any functional difference between the built-in JavaScript stuff and the Rhino builds obtainable from Mozilla?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你所说的 API 有何不同。 Java 6 有一个脚本引擎,其中可用的引擎之一是 Rhino,用“js”表示。因此,捆绑的 Mozilla Rhino ECMAScript 与您从其网站上获得的 ECMAScript 之间的唯一区别是版本之间的差异。我相信 Mozilla Rhino ECMAScript 的捆绑版本是 1.6 rev2。
这与 XML 库的工作方式类似。有一个具有默认实现的“引擎”。
客户端使用示例
更新
只是为了进一步回答您的问题,是的,Java 6 脚本引擎会处理您需要的上下文和其他设置操作如果直接使用Rhino则必须手动完成。这是使用两者的示例。请记住,当您使用 Java6 脚本引擎时,类似的事情也会在幕后发生。这里使用的 ScriptingEngine 不必由 Rhino 支持。它可以有一个自定义脚本实现。
I'm not sure what you meant by the API's are different. Java 6 has a scripting engine in which one of the available engines is Rhino denoted by "js". So the only difference between the bundled Mozilla Rhino ECMAScript and the one you can get from their website will be the differences between the versions. I believe the bundled version of Mozilla Rhino ECMAScript is 1.6 rev2.
This is similar to the way the XML libraries work. There is a "engine" that has a default implementation.
Example Client Usage
Update
Just to answer your question a little more, yes the Java 6 Scripting Engine takes care of contexts and other setup operations that you have to do manually if using Rhino directly. Here is an example of using the two. Keep in mind that when you use the Java6 Scripting Engine, similar things are happening underneath the hood. The ScriptingEngine used here DOES NOT have to be backed by Rhino. It could have a custom scriping implementation.