Forum: JRuby Issue loading JRuby ScriptEngine manually.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eric B. (Guest)
on 2008-10-14 06:44
(Received via mailing list)
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:
[quote]
:1:
no such file to load -- builtin/core_ext/symbol (LoadError)
 ...internal jruby stack elided...
 from (unknown).(unknown)(:1)
[/quote]

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
Paweł Wielgus (Guest)
on 2008-10-14 10:45
(Received via mailing list)
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>:
Eric B. (Guest)
on 2008-10-14 11:58
(Received via mailing list)
Hi Paweł,
   Thank you very much for the response. Here's essentially what I'm
doing:
[code]
JRubyScriptEngineFactory factory = new JRubyScriptEngineFactory();
JRubyScriptEngine engine = (JRubyScriptEngine)factory.getScriptEngine();
[/code]

The files I have included in the jEdit classpath are:
[quote]
asm-2.2.3.jar
backport-util-concurrent.jar
jruby-engine.jar
jruby.jar
script-api.jar
[/quote]

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>
Paweł Wielgus (Guest)
on 2008-10-14 12:46
(Received via mailing list)
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>:
Damian S. (Guest)
on 2008-10-14 13:33
(Received via mailing list)
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 :-)

> 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
This topic is locked and can not be replied to.