import org.jruby.Ruby;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;
{...}
// Create runtime instance
Ruby runtime = JavaEmbedUtils.initialize(new ArrayList());
RubyRuntimeAdapter evaler = JavaEmbedUtils.newRuntimeAdapter();
{...}
evaler.eval(runtime, "puts 1+2");
{...}
// Shutdown and terminate instance
JavaEmbedUtils.terminate(runtime);
https://github.com/jruby/jruby/wiki/DirectJRubyEmbedding