Debugging between JRuby and Java


I have a large Java project that uses some Ruby scripts (primarily
because of Ruby’s support for “yield”). The Ruby code calls Java code
which calls more Ruby code. It’s very interleaved, but everything is
driven from Java.

I’m using embedded jruby-standalone and building a jar-with-dependencies
(via maven). I’m using a maven plugin to run jrubyc and generate .java
files which maven compiles for me.

When I run the jar-with-dependencies, I can attach my debugger to the
Java process with no problems, but I’d really love to be able to debug
the Ruby code. Is there a solution for this?

I’m not launching any kind of jruby executable to which I could attach
arguments. It’s embedded in the jar and invoked via java -jar.

(Cross-posted to StackOverflow at


Embed pry-remote in your gems and code. You’ll be able to debug in