Javascript engine can not be found - scripting for the Java platform
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.
From JSR 270 (the Java 6 SE spec):
There will be no requirement that any particular scripting language be supported by the platform; implementors may choose to include support for the scripting language(s) of their choice as they see fit.
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.
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.
精彩评论