Issue loading JRuby ScriptEngine manually


#1

Hello all,
I’m extending the jEdit text editor to allow for the use of
scripting.dev.java.net ScriptEngines and I’m having issues getting the
JRuby
engine to work.

I’m not quite sure what the issue is, I get this error:

When trying to create a new JRubyScriptEngine manually, and when I try
to
create it using a manually created JRubyScriptEngineFactory.

jEdit has it’s own classloader and I’m thinking this may be an issue but
I’m
not sure.

I’ve successfully managed to integrate the Groovy, Javascript (Rhino),
ant
Jython engines using the same techniques, so I’m thinking the JRuby one
needs to be set up differently.

Any help with this would be greatly appreciated.

Thanks,
Eric


#2

Hi Eric,
what do You mean by “create a new JRubyScriptEngine manually”?
maybe some code samples will show where is the problem.
I’m using jsr223 and have no problems with it.
Are You sure all jars are present on classpath?

Best greetings,
Pawe³ Wielgus.

2008/10/14 Eric B. removed_email_address@domain.invalid:


#3

Hi Paweł,
Thank you very much for the response. Here’s essentially what I’m
doing:

JRubyScriptEngineFactory factory = new JRubyScriptEngineFactory();
JRubyScriptEngine engine = (JRubyScriptEngine)factory.getScriptEngine();

The files I have included in the jEdit classpath are:

When I execute the above code inside the jEdit application I get the
error
mentioned below.

Again, I know that jEdit uses it’s own Classloader, and I’m fairly
certain
that it’s causing issues. However, I’ve done the same thing with the
Groovy,
Jython, and Javascript engines without any problems. The error below
really
is all I have, and it’s just not very helpful to me.

Thanks for any help you can provide.

Cheers,
Eric

2008/10/13 Paweł Wielgus removed_email_address@domain.invalid


#4

Eric B. wrote:

from (unknown).(unknown)(:1)
[/quote]

The problem is that it can’t load the file symbol.rb. That’s part of
jruby, either under the site_ruby directory (iirc) or in the jruby jar
file itself, under jruby.home. I guess the first thing to do is check
you have it somewhere :slight_smile:

When trying to create a new JRubyScriptEngine manually, and when I try
to create it using a manually created JRubyScriptEngineFactory.

jEdit has it’s own classloader and I’m thinking this may be an issue but
I’m not sure.

That sounds possible. There’s an issue collecting various load / require
problems.[1] If you have got symbol.rb somewhere then try the dev list
or irc?

Damian

[1] http://jira.codehaus.org/browse/JRUBY-3048


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#5

Hi Eric,
my version is:
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine rubyEngine = m.getEngineByName(“jruby”);
rubyEngine.setContext(new SimpleScriptContext());
rubyEngine.eval(“your script here”);

Maybe You could try it and check if it will work for You.
You will need java6 for it to work, and most fresh jruby-engine, i
think something like 1.1.5 and most fresh jruby.

Best greetings,
Pawe³ Wielgus.

2008/10/14 Eric B. removed_email_address@domain.invalid: