static Ruby getRuntime(final JTextComponent text) { final TextAreaReadline tar = new TextAreaReadline(text, " " + NbBundle.getMessage(IrbTopComponent.class, "IrbWelcome") + " \n\n"); // NOI18N // Ensure that ClassPath can find libraries etc. RubyInstallation.getInstance().setJRubyLoadPaths(); final PipedInputStream pipeIn = new PipedInputStream(); final RubyInstanceConfig config = new RubyInstanceConfig() {{ setInput(pipeIn); setOutput(new PrintStream(tar.getOutputStream())); setError(new PrintStream(tar.getOutputStream())); setObjectSpaceEnabled(false); //setArgv(args); }}; final Ruby runtime = Ruby.newInstance(config); runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(System.identityHashCode(runtime)))); runtime.getLoadService().init(new ArrayList()); tar.hookIntoRuntime(runtime); return runtime; }