David Grayson edited this page Aug 3, 2013 · 6 revisions
Clone this wiki locally

There is a Java-based JRuby implementation of the fast ruby debugger rdebug.

See: JRuby Fast Debugger

Note that more recent versions of jruby (1.5+) already include the gem pre-bundled, so a

require 'rubygems'
require 'ruby-debug'

is probably all you'll need. If that does not work, run jruby -S gem install ruby-debug and then try again.

If you're running an older version of jruby then you'll need to follow these instructions:

jruby -S gem install ruby-debug-base-
  • Leave the directory or remove ruby-debug-base- from the directory and install ruby-debug with:
jruby -S gem install --ignore-dependencies ruby-debug
jruby -S gem install --ignore-dependencies ruby-debug-ide # needed only for IDEs
  • Install the columnize gem (unless you already have):
jruby -S gem install columnize

Note: the --debug option used below works only with JRuby 1.1.3 and later. For older versions you need to stick with the old option, using -J-Djruby.reflection=true -J-Djruby.compile.mode=OFF instead --debug.

Starting the debugger on a Rails application:

cd my_rails_app
jruby --debug -S rdebug script/server

Starting the debugger to test a local ruby program and adding ''lib/'' to the load path:

ruby --debug -S rdebug -Ilib rubyprogram.rb 

or you can call it programmatically within the script

require 'ruby-debug'

just make sure to run it under a jruby with the --debug flags passed to it, or "next" will always act as if it were the "step" command.

External Resources: