Created
January 12, 2014 16:29
-
-
Save dulichan/8386898 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
import javax.script.ScriptException; | |
public class RhinoEngine { | |
public static void main(String[] args) { | |
ScriptEngineManager mgr = new ScriptEngineManager(); | |
ScriptEngine engine = mgr.getEngineByName("JavaScript"); | |
try { | |
engine.put("name", args[0]); | |
engine.eval("print('Hello ' + name + '!')"); | |
} catch (ScriptException ex) { | |
ex.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment