JSR 223 ScriptEngine and setting out and in

Hi all,

it looks like the ScriptEngineFactory doesn’t have a API to set the
configuration of the ScriptContainer object ?

The JRubyEngine will call terminate on it and it will close the
PrintStreams
used for output, which will mess up the Java system calling JRuby.

It looks like JSR223 does all we want otherwise.

Thanks,

Antoine

Hi,

On Wed, Oct 27, 2010 at 2:42 AM, Antoine T.
[email protected] wrote:

Hi all,
it looks like the ScriptEngineFactory doesn’t have a API to set the
configuration of the ScriptContainer object ?

No, it doesn’t. So, for configuration, you need to set Java’s system
properties.

The JRubyEngine will call terminate on it and it will close the PrintStreams
used for output, which will mess up the Java system calling JRuby.
It looks like JSR223 does all we want otherwise.

What JRuby version are you using?
That behavior has been changed since JRuby 1.5RC1. Current JRubyEngine
doesn’t call terminate unless it is called explicitly.

-Yoko

We have had a hard time finding an OSGi-compliant jruby that would work
for
JSR223.
We ended up using this old class:
com.sun.script.jruby.JRubyScriptEngine.

Do you have a tutorial for embedding jruby as JSR223 for OSGi ?

The system properties I saw in jruby 1.5.2 didn’t mention a possibility
to
set out, err or in.

Thanks,

Antoine

We were using outdated code it seems. Thanks !