Created
August 1, 2014 06:26
-
-
Save eriksk/26afde7a810f9fa8db7d to your computer and use it in GitHub Desktop.
Java JRuby Scripting
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
ScriptEngineManager manager = new ScriptEngineManager(); | |
ScriptEngine engine = manager.getEngineByName("jruby"); | |
if(engine == null){ | |
System.out.println("failed to load jruby"); | |
return; | |
} | |
ScriptContext context = engine.getContext(); | |
try { | |
Object eval = engine.eval("puts 'Hello JRuby'", context); | |
} catch (ScriptException ex) { | |
ex.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment