@Override
    Object getRubyInstanceConfig() throws JRubyInvalidRuntimeException {
        final Object provider = this.getProvider();
        if (provider == null) {
            throw new JRubyInvalidRuntimeException(
                    "ScriptingContainer#getProvider() returned invalid LocalContextProvider unexpectedly.");
        }
        if (this.method_getRubyInstanceConfig == null) {
            throw new JRubyInvalidRuntimeException(
                    "LocalContextProvider#getRubyInstanceConfig is unavailable unexpectedly.");
        }

        try {
            return this.method_getRubyInstanceConfig.invoke(provider);
        } catch (RuntimeException ex) {
            throw ex;
        } catch (IllegalAccessException ex) {
            throw new JRubyInvalidRuntimeException(
                    "LocalContextProvider#getRubyInstanceConfig is inaccessible unexpectedly.", ex);
        } catch (InvocationTargetException ex) {
            final Throwable cause = ex.getCause();
            if (cause instanceof Error) {
                throw (Error) cause;
            } else if (cause instanceof RuntimeException) {
                throw (RuntimeException) cause;
            } else {
                throw new JRubyRuntimeException(cause);
            }
        }
    }
Indirects onto JRuby not to require JRuby classes directly.

It calls methods of ScriptingContainer through reflection.

This trick enables Embulk:

<ul>
<li>To load a JRuby runtime (jruby-complete-*.jar) specified at runtime out of embulk-*.jar.
<li>To switch versions of JRuby without releasing or repackaging.
<li>To distribute Embulk without JRuby runtimes embedded.
</ul>
embulk-core/src/main/java/org/embulk/jruby/ScriptingContainerDelegateImpl.java