/* Initializes jruby in its own thread */ private void setUpJRuby() { if (!Script.initialized()) { irbOutput.append("Initializing JRuby..."); new Thread("JRuby-init") { public void run() { // try to avoid ANR's Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); Script.setUpJRuby( new PrintStream( new OutputStream() { @Override public void write(int arg0) throws IOException { IRB.appendToIRB(Character.toString((char) arg0)); } })); handler.post(notifyComplete); } }.start(); } else { notifyComplete.run(); } }