On Thu, Jul 29, 2010 at 7:18 PM, Trejkaz [email protected] wrote:
For instance, for normal IRB we can do this:
require ‘irb’
IRB.start(FILE)
Although at present, obscure permissions issues in a secure
environment prevents this working under JRuby, it does at least get to
starting IRB before failing.
Do you have any error message or exception when starting IRB failed?
Maybe I’m misunderstanding, but we are using
//ScriptContext context
context.setAttribute(ScriptEngine.FILENAME, file,
ScriptContext.ENGINE_SCOPE);
And this appears to set FILE from within the script… but may
this other setScriptFilename() does something different, as I haven’t
been using ScriptContainer quite as much as the standard mechanism.
Yes, you can set FILE when you use eval methods with Reader
object. When a script is given as a String, ScriptEngine.FILENAME
didn’t work.
OK. So, I fixed this problem in rev. 7bda00f. I also fixed classpath
setting bug in this commit. Now, you can start swing IRB from JSR223
like in below:
package evergreen;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
public class JirbSwingJsr223 {
String jrubyhome =
“file:/Users/yoko/Projects/jruby/lib/jruby-complete.jar!/META-INF/jruby.home”;
private JirbSwingJsr223() throws ScriptException {
System.setProperty("org.jruby.embed.localcontext.scope",
“singlethread”);
System.setProperty(“org.jruby.embed.class.path”, jrubyhome +
“/bin”);
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName(“jruby”);
engine.getContext().setAttribute(ScriptEngine.FILENAME,
jrubyhome + “/bin/jirb_swing”, ScriptContext.ENGINE_SCOPE);
engine.eval(“load ‘jirb_swing’”);
}
public static void main(String[] args) throws ScriptException {
new JirbSwingJsr223();
}
}
-Yoko
TX
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email