Java Reference
In-Depth Information
Language Version:2.5
Engine Short Names:[python, jython]
Mime Types:[text/python, application/python, text/x-python,
application/x-python]
----------------------------
Engine Name:JSR 223 JRuby Engine
Engine Version:1.7.0.preview1
Language Name:ruby
Language Version:jruby 1.7.0.preview1
Engine Short Names:[ruby, jruby]
Mime Types:[application/x-ruby]
----------------------------
Engine Name:Groovy Scripting Engine
Engine Version:2.0
Language Name:Groovy
Language Version:2.0.0-rc-2
Engine Short Names:[groovy, Groovy]
Mime Types:[application/x-groovy]
----------------------------
Engine Name:Oracle Nashorn
Engine Version:1.8.0_05
Language Name:ECMAScript
Language Version:ECMA - 262 Edition 5.1
Engine Short Names:[nashorn, Nashorn, js, JS, JavaScript, javascript,
ECMAScript, ecmascript]
Mime Types:[application/javascript, application/ecmascript, text/javascript,
text/ecmascript]
----------------------------
Listing 1-4 shows how to print a message on the standard output using JavaScript,
Groovy, Jython, and JRuby. If a script engine is not available, the program prints a
message to that effect.
Listing 1-4. Printing a Message on the Standard Output Using Different Scripting
Languages
// HelloEngines.java
package com.jdojo.script;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class HelloEngines {
 
Search WWH ::




Custom Search