ScriptEngine doesn't write output into Writer

Hi!

I've just tried to use the new JSR 223 in Java SE 6. I have the following code snippet:

ScriptEngine engine =new ScriptEngineManager().getEngineByName("php");

ScriptContext ctx = engine.getContext();

StringWriter writer =new StringWriter();

ctx.setWriter(writer);

try{

engine.eval("<? echo 'test'; ?>");

}catch (ScriptException e){

e.printStackTrace();

}

System.out.println("Output:" + writer);

This code results in the following output:

Output:test

So far so good. If I don't use the quercus php engine (http://quercus.caucho.com/) but for example a Ruby engine (JRuby + JSR 223-libs from scripting.dev.java.net) I always get the wrong output:

test

Output:

Which means that the Ruby engine and some other engines like python doesn't care about the StringWriter object I passed, but instead puts the output directly on the Java console. Unfortunately I need the output for further processing. So my question is, if this is a bug of some engines or isn't the use of the Writer mandatory by the JSR 223 specification?

Thanks a lot in advance.

Best wishes

baennaeck

[1521 byte] By [baennaecka] at [2007-11-26 23:51:30]
# 1
OK, it seems to be a known bug.For JRuby see: https://scripting.dev.java.net/issues/show_bug.cgi?id=8For jython see: https://scripting.dev.java.net/issues/show_bug.cgi?id=13
baennaecka at 2007-7-11 15:30:18 > top of Java-index,Java Essentials,Java Programming...