找不到 Javascript 引擎 - Java 平台的脚本编写
最近,我的一些用户报告了 NullPointers 的问题。感谢其中之一,我设法发现我的应用程序找不到理论上应该随 JRE 一起提供的 Javascript 引擎(无论如何,大多数都具有 JDK)。
他们如何手动安装脚本引擎?
预先感谢...
PS 这些人大多数都有 OpenJDK。然而,这不会发生在我身上(我也是 OpenJDK 用户)...... 编辑:他们至少有 1.5 版本,大多数都有 1.6 版本。
Recently some of my users have been reporting problems with NullPointers. Thanks to one of them, I have managed to find out that my application can't find the Javascript engine that should theoretically come with the JRE (most of them have the JDK anyway).
How can they manually install the scripting engine?
Thanks in advance...
P.S. Most of these people have OpenJDK. However, this doesn't happen to me (I am also an OpenJDK user)...
EDIT: They have at least version 1.5, most of them have 1.6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 JSR 270(Java 6 SE 规范):
因此,可以想象存在不支持 JavaScript 的 JRE。引擎名称、语言名称和捆绑版本也可能有所不同。 “JavaScript”是 Oracle 商标,因此一些供应商可能不愿意将其用作标识符字符串。
From JSR 270 (the Java 6 SE spec):
So, it is conceivable that there are JREs out there without JavaScript support. There may also be variations in engine names, language names and versions bundled. "JavaScript" is an Oracle trademark so some vendors might be reluctant to use it as an identifier string.
Rhino 引擎仅与 Java 自 Java 6 起。因此,您的 Java 5/1.5 用户不会预安装它。
也就是说,您可以从 Mozilla 的网站手动获取 JavaScript 引擎 Rhino,因为引擎本身可以与 Java 5 配合使用。但是,您必须使用 Rhino 的 API,而不是使用 Java 的 ScriptEngine 接口。
The Rhino engine has only been bundled with Java since Java 6. Thus, your Java 5/1.5 users won't have it preinstalled.
That said, you can get Rhino, the Javascript engine, manually from Mozilla's site, since the engine itself does work with Java 5. However, you will have to use Rhino's API, rather than working with Java's ScriptEngine interface.