Trouble using JRuby in Java


#1

Hello,

I’ve tried to follow the JRuby’s wiki advice and examples on how to
utilise
JRuby from Java, but I keep running into an exception that produces an
exception which I can’t debug.

The code I’m using to initialise JRuby is:

ScriptEngineManager scriptEngineManger = new ScriptEngineManager();

ScriptEngine scriptEngine = scriptEngineManger.getEngineByName(“jruby”);

scriptEngine.eval(“puts 1 + 2”);

I’ve made sure to include jruby-engine.jar, bsf.jar, and jruby.jar on
the
classpath. Additionally, I’ve also specified the jruby.home VM parameter
(-Djruby.home:"/usr/local/jruby-1.3"). However, when the script engine
tries
to evaluate the simple ruby code I get the following exception:

Exception in thread “AWT-EventQueue-0” java.lang.NoSuchMethodError:
org.jruby.Ruby.runNormally(Lorg/jruby/ast/Node;Z)Lorg/jruby/runtime/builtin/IRubyObject;

at com.sun.script.jruby.JRubyScriptEngine.evalNode(
JRubyScriptEngine.java:454)

at
com.sun.script.jruby.JRubyScriptEngine.eval(JRubyScriptEngine.java:180)

at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)

at
uk.ac.abdn.babytalk2.readability.ReadabilityScore.generateReadabilityScores(
ReadabilityScore.java:449)

I was wondering whether there is something I’ve missed or overlooked?
Any
help would be most appreciated.

Many Thanks,

Saad Mahamood.


#2

Saad Mahamood wrote:

Exception in thread “AWT-EventQueue-0” java.lang.NoSuchMethodError:
org.jruby.Ruby.runNormally(Lorg/jruby/ast/Node;Z)Lorg/jruby/runtime/builtin/IRubyObject;

Hmm…I’m guessing this is something that broke in JRuby that doesn’t
match the jruby-engine anymore. Can you try 1.2.0 and then report a bug
if that fixes it?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#3

On Wed, May 6, 2009 at 7:40 PM, Charles Oliver N.
removed_email_address@domain.invalid wrote:

ScriptEngine scriptEngine = scriptEngineManger.getEngineByName(“jruby”);
Exception in thread “AWT-EventQueue-0” java.lang.NoSuchMethodError:
org.jruby.Ruby.runNormally(Lorg/jruby/ast/Node;Z)Lorg/jruby/runtime/builtin/IRubyObject;

Hmm…I’m guessing this is something that broke in JRuby that doesn’t match
the jruby-engine anymore. Can you try 1.2.0 and then report a bug if that
fixes it?

JSR 223 JRuby engine works perfectly on JRuby 1.1.6 and before. You
might get it run on JRuby 1.2.0, but not perfect. Probably, this error
came from JRuby engine, not JRuby.
In (hopefuly near) future, embed API for Java (a project is now moving
from http://kenai.com/projects/redbridge to
http://kenai.com/projects/jruby-embed) will be available to use on the
latest JRuby.

-Yoko

  • Charlie

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

#4

Saad Mahamood wrote:

I’d just like to confirm that regressing back to JRuby 1.1.6 has made
the above code function correctly. Thank you for help!

I fixed this for 1.3, so you shouldn’t have to stay on 1.1.6 for long.
Can someone with JSR-223 stuff handy test out master?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#5

2009/5/7 Yoko H. removed_email_address@domain.invalid

The code I’m using to initialise JRuby is:
(-Djruby.home:"/usr/local/jruby-1.3"). However, when the script engine
the jruby-engine anymore. Can you try 1.2.0 and then report a bug if that
-Yoko

I’d just like to confirm that regressing back to JRuby 1.1.6 has made
the
above code function correctly. Thank you for help!

Saad.