Created
July 30, 2015 09:37
-
-
Save relax-more/60654cc57f7bf333ff1f to your computer and use it in GitHub Desktop.
Java <-> Javascript
This file contains hidden or 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
http://www.techscore.com/tech/Java/JavaSE/JavaSE6/5/ |
This file contains hidden or 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 ScriptingMain | |
{ | |
public static void main(String[] arguments) | |
{ | |
ScriptEngineManager manager = new ScriptEngineManager(); | |
ScriptEngine engine = manager.getEngineByName("javascript"); | |
try { | |
String script = "print('Hello Scripting')"; | |
engine.eval(script); | |
} catch(ScriptException exception) { | |
exception.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment