JRuby executing JS w Nashorn ...

James Ladd james_ladd at hotmail.com
Mon Feb 10 17:34:34 PST 2014

I asked about jRuby executing javascript with Nashorn a while
ago. It was simple and here is the code should anyone else 
need to do it. 

        factory = javax.script.ScriptEngineManager.new
        engine = factory.getEngineByName 'nashorn'
        bindings = engine.createBindings

        engine.eval javascript_code, bindings

Yes it is easy but sometimes its good to see and cut-n-paste.

- James.

More information about the nashorn-dev mailing list