« Return to Thread: Re: Trying to get jruby classes/methods into java code. (JRuby applet, OGL)

Re: Trying to get jruby classes/methods into java code. (JRuby applet, OGL)

by Rob . :: Rate this Message:

Reply to Author | View in Thread

I've had the same problem with jrubyc compiled classes that you
mentioned in point (3). Decompiling shows methods like this in the
Java class:

public class MyClass extends AbstractScript {...

 public IRubyObject initialize__5(ThreadContext threadcontext,
                                  IRubyObject irubyobject,
                                  IRubyObject[] irubyobjects, Block
block) {... }

 public IRubyObject method1__6(ThreadContext threadcontext,
                               IRubyObject irubyobject,
                               IRubyObject[] irubyobjects, Block block) {... }


I was expecting:

public class MyClass extends RubyObject {
 public MyClass(Object arg1, Object arg2) {... }

 public Object method1(Object arg1) {... }


-Rob

On Tue, Apr 8, 2008 at 11:54 PM, sikanrong <sikanrong@...> wrote:

>
>  Hey guys. So, I'm not new to Java, and I'm really not new to Ruby, but I'm a
>  complete JRuby beginner somehow :)
>
>  I've read every tutorial and wiki page on the subject, but I keep hitting
>  walls. Here's the deal: I'm trying to get OGL stuff into an Applet using
>  JRuby. I know, I could've picked something easier, but I really think this
>  would be cool if i could finish it! So, I've got the JOGL jars in the
>  appropriate places, and I have a helloworld.rb script that creates exactly
>  what I want in a JFrame. Now I need to take the same functionality and port
>  it to an applet. I also have an applet that's doing what I want in pure
>  Java. What I want to do is define a ruby class which 'implements' the java
>  class GLEventListener, (via 'include'). Then, SOMEHOW, I want to instantiate
>  an object of that class in Java and plug it in to the applet.
>
>  So far, i just can't pull the object out of ruby and get it into java. I've
>  tried everything under the sun, and by that I mean
>
>  1) making a java wrapper for the class I want to wrap in ruby (a-la
>  jrubywiki getting started demo source). Didn't work.
>
>  2) found a GREAT and almost completely un-documented class called
>  JRubyApplet. This failed out too, kindof. It did eval the script properly,
>  but when I tried to create a GLEventListener in ruby (which works fine when
>  just running it in JRuby) i get a 'not visible to class loader' error. Why??
>  It's in the classpath, and if JRubyApplet worked it would be the absolute
>  best way for me to do this
>
>  3) Tried using jrubyc (JRuby compiler). Besides the fact that this didn't
>  work with what I'm trying to do, it is just plain really freaking cool to be
>  able to compile ruby script into Java Byte code. What did work is the
>  compiler. What did NOT work is calling methods or classes defined inside
>  java after importing the class to a Java script. Like, i could compile and
>  import (and even instantiate) an object of ruby.MyRubyWrapper, but then I
>  just get 'symbol not defined' errors when trying to call the methods I
>  defined in ruby. This was especially confusing to me, because in the wiki
>  documentation on the JRuby compiler you (Nutter) said that basically
>  file-level methods and classes were all available to the Java object as java
>  methods. What gives?? HELP!!
>
>  Anyway, if this is Nutter himself, I just met you in Prague! (I was the only
>  one with dreadlocks), What's up dude!!
>
>  --
>  View this message in context: http://www.nabble.com/Trying-to-get-jruby-classes-methods-into-java-code.-%28JRuby-applet%2C-OGL%29-tp16575797p16575797.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
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Re: Trying to get jruby classes/methods into java code. (JRuby applet, OGL)