Hello!
I have a compiled (with jrubyc) Ruby class in classpath of my Java
application (on Eclipse), and I can see this class on my Java code.
*** RUBY CLASS ***
class Cachorro
def diga_ola
puts ‘Ola!’
end
end
*** JAVAP ***
javap Cachorro
Compiled from “Cachorro.rb”
public class Cachorro extends org.jruby.ast.executable.AbstractScript{
public Cachorro();
public static {};
public org.jruby.runtime.builtin.IRubyObject
file(org.jruby.runtime.Thre
adContext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runtime.Block);
public org.jruby.runtime.builtin.IRubyObject
class_0$RUBY$Cachorro(org.jruby
.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runtime
.Block);
public org.jruby.runtime.builtin.IRubyObject
method__1$RUBY$diga_ola(org.jru
by.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runti
me.Block);
public org.jruby.runtime.builtin.IRubyObject
method__1$RUBY$diga_ola(org.jru
by.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runti
me.builtin.IRubyObject[], org.jruby.runtime.Block);
public org.jruby.runtime.builtin.IRubyObject
class_0$RUBY$Cachorro(org.jruby
.runtime.ThreadContext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runtime
.builtin.IRubyObject[], org.jruby.runtime.Block);
public org.jruby.runtime.builtin.IRubyObject
file(org.jruby.runtime.Thre
adContext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runtime.builtin.IRub
yObject[], org.jruby.runtime.Block);
public org.jruby.runtime.builtin.IRubyObject
load(org.jruby.runtime.ThreadCo
ntext, org.jruby.runtime.builtin.IRubyObject,
org.jruby.runtime.builtin.IRubyObj
ect[], org.jruby.runtime.Block);
public static void main(java.lang.String[]);
}
*** JAVA CLASS ***
public class Adestrador {
public static void main(String[] args) {
Cachorro c = new Cachorro();
}
}
This code worked without problem.
But, if I do call c.diga_oi(), I get a exception, because diga_oi() is
not
exist.
So, the method method__1$RUBY$diga_ola already exist, but diga_ola no.
What the problem?
Somebody can help me?
Thanks so much!
My files:
http://www.nabble.com/file/p18967254/Adestrador.java Adestrador.java
http://www.nabble.com/file/p18967254/Cachorro.rb Cachorro.rb
http://www.nabble.com/file/p18967254/Cachorro.class Cachorro.class
My environment:
- JDK 1.5.0_13
- JRuby 1.1.3
–
View this message in context:
http://www.nabble.com/Calling-Ruby-".class"-from-Java-tp18967254p18967254.html
Sent from the JRuby - User mailing list archive at Nabble.com.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email