Last active
October 28, 2019 13:07
-
-
Save headius/392a19044bca1996ec8ff9815c7acafe to your computer and use it in GitHub Desktop.
Calling into JavaScript from JRuby using javax.script
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
>> java_import javax.script.ScriptEngineManager | |
=> [Java::JavaxScript::ScriptEngineManager] | |
>> mgr = ScriptEngineManager.new | |
=> #<Java::JavaxScript::ScriptEngineManager:0x780cb77> | |
>> js = mgr.getEngineByExtension("js") | |
=> #<Java::JdkNashornApiScripting::NashornScriptEngine:0x60015ef5> | |
>> js.eval("print(1)") | |
1 | |
=> nil | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment