-
-
Save h4wkst3r/aa03b30bfd77e0393be1bf3d97b137b8 to your computer and use it in GitHub Desktop.
Example invoking Nashorn Javascript Engine from Java
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 test { | |
public static void main(String[] args) throws ScriptException { | |
// initialize nashorn scripting engine | |
ScriptEngineManager manager = new ScriptEngineManager(); | |
ScriptEngine nashorn = manager.getEngineByName("nashorn"); | |
nashorn.eval("print('TEST')"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment