Skip to content

Instantly share code, notes, and snippets.

@eriksk
Created August 1, 2014 06:26
Show Gist options
  • Save eriksk/26afde7a810f9fa8db7d to your computer and use it in GitHub Desktop.
Save eriksk/26afde7a810f9fa8db7d to your computer and use it in GitHub Desktop.
Java JRuby Scripting
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