From: Charles Oliver Nutter Date: 2007-09-03T04:31:41+09:00 Subject: Re: How can I debug a JRuby class that is invoked from a Java application? 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