Forum: JRuby Eval JRuby method then Swing Component pressed

Posted by Michał K. (micha_k82)
on 2012-06-25 00:02
Hi,
I have this java and ruby code https://gist.github.com/2985172 and I'm
trying to run ruby code instead of java after some action. I tried to
override java function but it's still running java version of code. So
how can I do this without calling ruby code from .java file?
Posted by Robin McKay (robin2)
on 2012-06-27 20:07
As you have not had any other response may I add my 2 cents worth.

I presume from your comment that the Java code works properly and prints 
the word "test" but you would like it to use the JRuby code and print 
the words "It works". If the Java code doesn't work the first step must 
be to correct things there.

Assuming the Java code works as you expect I think I must ask the 
question "why do you expect it to use the JRuby code?" I can see no 
reason why it should - regardless of whether you have an equivalent Java 
method or not.

I have only tried getting JRuby to call Java - not the other way round. 
But as I understand it there are various requirements to be met before 
Java will call JRuby and I see nothing like that in your code.

It's not as if you are using JRuby to call a Java function and expect 
JRuby to receive a return value - though that might be a way to 
construct your project. The Java stuff could return one of several 
replies depending on what happens and you could have JRuby code to 
figure out what to do.

If all you want is to display stuff in a GUI why not write the whole 
thing in JRuby? I presume you saw my reply to your earlier topic.
Posted by Thomas E Enebo (Guest)
on 2012-06-27 20:52
(Received via mailing list)
Try adding an initialize to your new Gui class which calls super().

-Tom

On Sun, Jun 24, 2012 at 5:02 PM, Michał K. <lists@ruby-forum.com> wrote:
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>



--
blog: http://blog.enebo.com       twitter: tom_enebo
mail: tom.enebo@gmail.com
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.