private static LazyScriptingContainerDelegate of(
            final boolean isEmbulkSpecific,
            final boolean initializesGem,
            final Logger logger,
            final EmbulkSystemProperties embulkSystemProperties) {
        final boolean useGlobalRubyRuntime = embulkSystemProperties.getPropertyAsBoolean("use_global_ruby_runtime", false);

        final String jrubyProperty = embulkSystemProperties.getProperty("jruby");

        final ArrayList<URL> jrubyUrlsBuilt = new ArrayList<>();
        if (jrubyProperty != null && !jrubyProperty.isEmpty()) {
            // File.pathSeparator is not available here because the property "jruby" expects a URL-like style:
            // "file:" and "mvn:". It now supports only "file:", though.
            //
            // Semicolons basically do not appear in URLs without quoting except for the "optional fields and values"
            // case described in RFC 1738. We don't need to take care of the "optional fields and values" case here.
            // https://tools.ietf.org/html/rfc1738
            for (final String jarLocator : jrubyProperty.split("\\;")) {
                if (jarLocator.startsWith("file:")) {
                    // TODO: Validate the path more.
                    final URL jarUrl;
                    try {
                        jarUrl = new URL(jarLocator);
                    } catch (final MalformedURLException ex) {
                        throw new JRubyInvalidRuntimeException("Embulk system property \"jruby\" is invalid: " + jrubyProperty, ex);
                    }
                    jrubyUrlsBuilt.add(jarUrl);
                } else {
                    throw new JRubyInvalidRuntimeException("Embulk system property \"jruby\" is invalid: " + jrubyProperty);
                }
            }
        }
        final List<URL> jrubyUrls = Collections.unmodifiableList(jrubyUrlsBuilt);

        final JRubyInitializer initializer = JRubyInitializer.of(
                isEmbulkSpecific,
                initializesGem,
                logger,
                embulkSystemProperties);

        final JRubyClassLoader jrubyClassLoader;
        try {
            jrubyClassLoader = new JRubyClassLoader(jrubyUrls, LazyScriptingContainerDelegate.class.getClassLoader());
        } catch (final RuntimeException ex) {
            return null;
        }

        try {
            jrubyClassLoader.loadClass("org.jruby.Main");
        } catch (final ClassNotFoundException ex) {
            return null;
        }

        try {
            final LazyScriptingContainerDelegate jruby = new LazyScriptingContainerDelegate(
                    jrubyClassLoader,
                    useGlobalRubyRuntime
                            ? ScriptingContainerDelegate.LocalContextScope.SINGLETON
                            : ScriptingContainerDelegate.LocalContextScope.SINGLETHREAD,
                    ScriptingContainerDelegate.LocalVariableBehavior.PERSISTENT,
                    initializer,
                    logger);
            if (useGlobalRubyRuntime) {
                // In case the global JRuby instance is used, the instance should be always initialized.
                // Ruby tests (in embulk-ruby/) are examples.
                jruby.getInitialized();
            }
            return jruby;
        } catch (Exception ex) {
            return null;
        }
    }
Indirects onto JRuby with initializing ScriptingContainer lazily.
embulk-core/src/main/java/org/embulk/jruby/LazyScriptingContainerDelegate.java