Netbeans Debugger Not Stopping at Breakpoints

I use Netbeans for doing development for JRuby.  When I say that I don’t mean I’m developing with JRuby, I mean for JRuby.  I’m writing Java code, and wanted to use the debugger for Java code.  Everytime I mentioned JRuby people would assume I was using it and developing Ruby code, that’s not the case at all.  By the way, an awesome way to learn the ins and outs of a language is to develop another language in it.  I’ve learned quite a bit about Java since I started working on this, and I’d have called myself proficient in Java before starting.

Anyway, when I was trying to use the Netbeans debugger on JRuby it wasn’t stopping at my breakpoints, and I couldn’t figure out why.  I thought it might have something to do with me using linux, and after people ran out of ideas they seemed to think the same thing.  This turned out to not be the case.  It was a problem with the ant script for running the debugger.

It was as simple as changing this:

    <nbjpdastart addressproperty="jpda.address" name="JRuby" transport="dt_socket">
      <classpath>        
        <pathelement path="${jruby.classes.dir}"/>
        <path refid="build.classpath"/>
      </classpath>      
    </nbjpdastart>

to this:

    <nbjpdastart addressproperty="jpda.address" name="JRuby" transport="dt_socket">
      <classpath>        
        <pathelement path="${jruby.classes.dir}"/>
        <path refid="build.classpath"/>
      </classpath>      
      <sourcepath path="${src.dir}"/>
    </nbjpdastart>

The sourcepath makes all the difference. I’m posting this because nbjpdastart has very little documentation, and it took me quite a while to figure this out. I hope this saves you some time.

Posted on December 2, 2008 at 9:03 pm by Joe · Permalink
In: Uncategorized · Tagged with: , , ,

Leave a Reply