CHAPTER 9 SCRIPTING AND JSR 223 181
CHAPTER 9 SCRIPTING AND JSR 223 181 System.err.println(e); } catch (ScriptException e) { System.err.println(e); } } } Running the program just displays the string sent to the JavaScript print() method. > java InterfaceTest wave jrunscript Mustang includes some new programs in the bin directory of the JDK. Many of these are considered experimental, at least in the beta release. One such program is jrunscript. Think of it as command-line access to the installed scripting engines. You can try out anything with jrunscript that you would pass into the eval() method of a ScriptEngine. First, to see what engines are installed, you can pass a -q option to jrunscript: jrunscript -q Language ECMAScript 1.6 implemention “Mozilla Rhino” 1.6 release 2 Tip To see all the available commands from jrunscript, use the -? or -help command-line options. With only one available in the default installation from Sun, you don t have to explicitly request to use a specific engine. But, if multiple were available, you could explicitly request a language with the -l option. The language string to pass in would be one of those returned from the scripting engine factory s getNames() method. As Listing 9-1 showed, any of the following will work for the provided ECMAScript 1.6 engine: js, rhino, JavaScript, javascript, ECMAScript, or ecmascript. Yes, the names are case sensitive. > jrunscript -l javascripT script engine for language javascripT can not be found
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services