start.rb calls Red.java’s hello method which calls hi.rb’s hi method
resulting in a NoSuchMethodError error. If I run Red.java directly,
instead of start.rb, then the code works. What’s the proper way to have
start.rb run the Java code without error?
Thanks.
start.rb
require ‘java’
require ‘…/…/dist/bridge.jar’
Java::bridge::Red.hello
hi.rb
def hi
puts ‘hi’
end
Red.java
ScriptingContainer container = new
ScriptingContainer(LocalContextScope.SINGLETON);
Object receiver = container.runScriptlet(PathType.CLASSPATH,
“ruby/hi.rb”);
container.callMethod(receiver, “hello”); # NoSuchMethodError
bridge/Red.java:in `hello’: java.lang.NoSuchMethodError:
org.jruby.embed.ScriptingContainer.callMethod(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;
(NativeException)
from /bridge/src/ruby/start.rb
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Hello,
On Thu, May 20, 2010 at 5:16 AM, consiliens [email protected]
wrote:
Java::bridge::Red.hello
container.callMethod(receiver, “hello”); # NoSuchMethodError
Did you try “container.callMethod(receiver, “hi”);” ? In this case,
ScriptingContainer evaluated “hi” method in a “ruby/hi.rb” file. Thus
the receiver knew “hi” method but not “hello.” I’m guessing this is
the reason you got NoSuchMethodError.
-Yoko
http://xircles.codehaus.org/manage_email
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On 05/20/2010 09:30 AM, Yoko H. wrote:
Did you try “container.callMethod(receiver, “hi”);” ? In this case,
ScriptingContainer evaluated “hi” method in a “ruby/hi.rb” file. Thus
the receiver knew “hi” method but not “hello.” I’m guessing this is
the reason you got NoSuchMethodError.
-Yoko
I fixed that error and after a Clean and Build the simple example works.
Thank you.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email