How can I debug a JRuby class that is invoked from a Java ap

I am using JRuby (through the standard JRE 6 support) to add some Ruby
classes to a big existing Java application.

This application is started as usual as any Java app (by running a
main method), and it eventually calls my Ruby code. Is there a way to
debug Ruby code which is being called from Java?

If not, is there any hack/workaround? I know I can unit-test my Ruby
code but if I want to debug the real (and complex) environment, I need
to have my Ruby code called from the Java application…

Thanks,

Luis.

Luis wrote:

I am using JRuby (through the standard JRE 6 support) to add some Ruby
classes to a big existing Java application.

This application is started as usual as any Java app (by running a
main method), and it eventually calls my Ruby code. Is there a way to
debug Ruby code which is being called from Java?

If not, is there any hack/workaround? I know I can unit-test my Ruby
code but if I want to debug the real (and complex) environment, I need
to have my Ruby code called from the Java application…

At the moment this is not yet possible. The challenge here is that most
of the Ruby debugging support out there depends on runtime hooks and
callbacks that comprise their own debugging framework and API. See the
debug-commons project on RubyForge for work on standardizing that.

However soon JRuby will be able to compile all Ruby code to Java
bytecode. You would conceivably then be able to step through Ruby code
just like Java code using any Java debugging tool, since the compiled
bytecode would have file and line number information. Taking that a
couple steps further to support breakpoints and profiling would not be
hard.

So then, the short answer is that this is not possible right now…but
it will be possible in the very near future.

  • Charlie

On Sep 2, 9:31 pm, Charles Oliver N. [email protected]
wrote:

to have my Ruby code called from the Java application…
couple steps further to support breakpoints and profiling would not be hard.

So then, the short answer is that this is not possible right now…but
it will be possible in the very near future.

  • Charlie

Charlie, that is great news. Could you give me an approximation of
when will that feature be available?

Thanks for your quick reply,

Luis.

Luis wrote:

So then, the short answer is that this is not possible right now…but
it will be possible in the very near future.

  • Charlie

Charlie, that is great news. Could you give me an approximation of
when will that feature be available?

Thanks for your quick reply,

Full compilation to Java is planned for JRuby 1.1, by end of October.
Probably 95% of Ruby syntax compiles right now.

  • Charlie

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs