that way, you probably set up a "built-in" (if not exit response, such as one ) JRuby from Java, for example. (JSR 223 may be similar - just use ScriptEngine.evalto run Ruby code):
ScriptingContainer scriptContainer = new ScriptingContainer(LocalContextScope.CONCURRENT);
scriptContainer.runScriptlet("load 'script.class'");
load.class script.class, , -/work-dir ( LOAD_PATH - Java/)