# Using debugger with jruby

**URL:** <https://www.ruby-forum.com/t/using-debugger-with-jruby/216730>\
**Category:** JRuby\
**Created:** [February 12, 2012, 4:23pm UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730 "2012-02-12T16:23:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 12, 2012, 4:23pm UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730/1 "2012-02-12T16:23:47Z")

</div>

I’m using jruby-1.6.6 in 1.9 mode and I want to use debugger in a  
rails application.  
I’m trying to install gem ruby-debug19 but I have the error:

Installing linecache19 (0.5.12) with native extensions  
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native  
extension.

```
    /home/mauro/jruby/bin/jruby extconf.rb

```

WARNING: JRuby does not support native extensions or the `mkmf’  
library very well.

How can I use debugger with jruby?

---

<div class="post-metadata">

**Author:** ![msan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@msan](https://www.ruby-forum.com/u/msan)\
**Post date:** [February 12, 2012, 4:36pm UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730/2 "2012-02-12T16:36:50Z")

</div>

I believe ruby-debug works for JRuby, regardless of the language mode.

–  
Hiro

---

<div class="post-metadata">

**Author:** ![msan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@msan](https://www.ruby-forum.com/u/msan)\
**Post date:** [February 12, 2012, 5:53pm UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730/3 "2012-02-12T17:53:48Z")

</div>

On 12 February 2012 16:35, Hirotsugu A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I believe ruby-debug works for JRuby, regardless of the language mode.

I’m trying ruby-debug but in debug mode when I do, for example:

(rdb:2) break 10

I run into this error:

INTERNAL ERROR!!! undefined method `entries' for #<String:0x531afc6a> /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/linecache-ruby.rb:8:in `lnums\_for\_str’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/tracelines.rb:25:in  
`lnums_for_str_array' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/linecache.rb:282:in `trace\_line\_numbers’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/commands/breakpoints.rb:71:in  
`execute' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:226:in `one\_cmd’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:319:in  
`process_commands' org/jruby/RubyArray.java:1614:in `each’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:318:in  
`process_commands' org/jruby/RubyKernel.java:1195:in `catch’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:311:in  
`process_commands' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:199:in `at\_line’  
(eval):5:in `at_line' (eval):3:in `at\_line’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/ruby-debug-base.rb:55:in  
`at_line' /home/mauro/projects/operatorieconomici/app/controllers/application_controller.rb:4:in `ApplicationController’  
/home/mauro/projects/operatorieconomici/app/controllers/application\_controller.rb:1:in  
`(root)' org/jruby/RubyKernel.java:1062:in `load’  
/home/mauro/projects/operatorieconomici/app/controllers/application\_controller.rb:469:in  
`load_file' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:639:in `new\_constants\_in’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:468:in  
`load_file' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:353:in `require\_or\_load’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:502:in  
`load_missing_constant' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `const\_missing’  
org/jruby/RubyArray.java:1614:in `each' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const\_missing’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in  
`const_missing' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/inherited_resources-1.3.0/app/controllers/inherited_resources/base.rb:11:in `InheritedResources’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/inherited\_resources-1.3.0/app/controllers/inherited\_resources/base.rb:1:in  
`(root)' org/jruby/RubyKernel.java:1062:in `load’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/inherited\_resources-1.3.0/app/controllers/inherited\_resources/base.rb:469:in  
`load_file' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:639:in `new\_constants\_in’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:468:in  
`load_file' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:353:in `require\_or\_load’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:502:in  
`load_missing_constant' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `const\_missing’  
org/jruby/RubyArray.java:1614:in `each' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const\_missing’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in  
`const_missing' /home/mauro/projects/operatorieconomici/app/controllers/companies_controller.rb:2:in `(root)’  
org/jruby/RubyKernel.java:1062:in `load' /home/mauro/projects/operatorieconomici/app/controllers/companies_controller.rb:469:in `load\_file’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:639:in  
`new_constants_in' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:468:in `load\_file’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:353:in  
`require_or_load' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:502:in `load\_missing\_constant’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:192:in  
`const_missing' org/jruby/RubyArray.java:1614:in `each’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/dependencies.rb:190:in  
`const_missing' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const\_missing’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/inflector/methods.rb:229:in  
`constantize' org/jruby/RubyArray.java:1614:in `each’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/inflector/methods.rb:228:in  
`constantize' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:554:in `get’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/routing/route\_set.rb:62:in  
`controller_reference' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:47:in `controller’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/routing/route\_set.rb:26:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/journey-1.0.1/lib/journey/router.rb:68:in `call’  
org/jruby/RubyArray.java:1614:in `each' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/journey-1.0.1/lib/journey/router.rb:56:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/routing/route\_set.rb:589:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/sass-3.1.15/lib/sass/plugin/rack.rb:54:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/warden-1.1.0/lib/warden/manager.rb:35:in  
`call' org/jruby/RubyKernel.java:1195:in `catch’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/warden-1.1.0/lib/warden/manager.rb:34:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/etag.rb:23:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/head.rb:14:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/remotipart-1.0.2/lib/remotipart/middleware.rb:30:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/params\_parser.rb:21:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/flash.rb:242:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in  
`context' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/cookies.rb:338:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activerecord-3.2.1/lib/active_record/query_cache.rb:64:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activerecord-3.2.1/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:443:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/callbacks.rb:408:in  
`_run __1733520973__ call __515768123__ callbacks' org/jruby/RubyBasicObject.java:1694:in ` **send** ’  
org/jruby/RubyKernel.java:2095:in `send' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `\_\_run\_callback’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/callbacks.rb:390:in  
`_run_call_callbacks' org/jruby/RubyBasicObject.java:1694:in ` **send** ’  
org/jruby/RubyKernel.java:2095:in `send' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run\_callbacks’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/callbacks.rb:27:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:65:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/remote\_ip.rb:31:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/show\_exceptions.rb:56:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/rack/logger.rb:26:in `call\_app’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/rack/logger.rb:16:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action_dispatch/middleware/request_id.rb:22:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/activesupport-3.2.1/lib/active\_support/cache/strategy/local\_cache.rb:72:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/actionpack-3.2.1/lib/action\_dispatch/middleware/static.rb:53:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/engine.rb:479:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/application.rb:220:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/rack/debugger.rb:20:in  
`call' /home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/railties-3.2.1/lib/rails/rack/log_tailer.rb:14:in `call’  
/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in  
`service’

So is it a jruby bug?

---

<div class="post-metadata">

**Author:** ![msan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@msan](https://www.ruby-forum.com/u/msan)\
**Post date:** [February 14, 2012, 12:51am UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730/4 "2012-02-14T00:51:14Z")

</div>

You might wanna try pry, [GitHub - pry/pry: A runtime developer console and IRB alternative with powerful introspection capabilities.](https://github.com/pry/pry), it works for me on  
1.9  
mode running on 1.6.6

- Samer

---

<div class="post-metadata">

**Author:** ![msan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@msan](https://www.ruby-forum.com/u/msan)\
**Post date:** [September 26, 2012, 2:11am UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730/5 "2012-09-26T02:11:49Z")

</div>

This is still an issue with the latest version. Are we going to have a  
fully functional ruby-debug in JRuby anytime soon?

---

<div class="post-metadata">

**Author:** ![msan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@msan](https://www.ruby-forum.com/u/msan)\
**Post date:** [April 27, 2012, 3:35am UTC](https://www.ruby-forum.com/t/using-debugger-with-jruby/216730/6 "2012-04-27T03:35:17Z")

</div>

Msan M. wrote in post #1046179:

> On 12 February 2012 16:35, Hirotsugu A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I believe ruby-debug works for JRuby, regardless of the language mode.
> 
> I’m trying ruby-debug but in debug mode when I do, for example:
> 
> (rdb:2) break 10
> 
> I run into this error:
> 
> INTERNAL ERROR!!! undefined method `entries’ for #String:0x531afc6a

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/linecache-ruby.rb:8:in

> `lnums\_for\_str’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/tracelines.rb:25:in

> `lnums\_for\_str\_array’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.4-java/lib/linecache.rb:282:in

> `trace\_line\_numbers’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/commands/breakpoints.rb:71:in

> `execute’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:226:in

> `one\_cmd’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:319:in

> `process_commands' org/jruby/RubyArray.java:1614:in `each’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:318:in

> `process_commands' org/jruby/RubyKernel.java:1195:in `catch’

/home/mauro/jruby-1.6.6/lib/ruby/gems/1.8/gems/ruby-debug-0.10.4/cli/ruby-debug/processor.rb:311:in

> `process\_commands’  
> [SNIP]
> 
> So is it a jruby bug?

I had the same issue, appears to be a bug in ruby-debug-base-0.10.4. I  
thought maybe 0.10.5.rc1 with its new linecache dependency might fix it  
but not, the issue remains. I’ve attached a patch that fixes the issue  
on ruby-debug-base-0.10.4. The same patch can be applied to  
linecache-0.46-java/lib/linecache/trace\_nums.rb as well, it is a simple  
two word change.
