Debugging the NetBeans Platform

Posted by Geertjan on Oracle Blogs See other posts from Oracle Blogs or by Geertjan
Published on Sun, 27 Nov 2011 17:41:24 -0600 Indexed on 2011/11/28 1:57 UTC
Read the original article Hit count: 357

Filed under:

Once you've set up the NetBeans Platform sources as your NetBeans Platform, you're able to debug the NetBeans Platform itself. That's an occasional question (certainly not a frequent question) on the mailing list and in NetBeans Platform courses: "Is it possible to debug the NetBeans Platform?"

Well, here's how:

  1. Firstly, set up the NetBeans Platform sources as your NetBeans Platform.

  2. Now, open into NetBeans IDE the NetBeans module where you'd like to place a breakpoint. That in itself is the hardest part of this task. I.e., you know you want to debug the NetBeans Platform, but have no idea where to place your breakpoint.

    One way to figure that out, from 7.1 onwards, is to take a visual snapshot of the NetBeans Platform and then analyze that snapshot in NetBeans IDE. To do this, right-click a module that you've set as using the NetBeans Platform sources as your NetBeans Platform and then choose Debug. The application, i.e., the NetBeans Platform, including your custom module, starts up and you'll see this, i.e., NetBeans IDE in debug mode together with your NetBeans Platform application:



    Notice there's a new toolbar button (new in NetBeans IDE 7.1) that resembles an orange camera. Click that button and the IDE creates a visual snapshot of the running application, which in this case is the NetBeans Platform. When you click components in the visual snapshot, the Navigator and Properties window display information about the related GUI component:


By clicking the above components, you can end up identifying the component you'd like to debug and even the module where it is found. Open that module. Set a breakpoint on the line of interest. Right-click the module again and choose Debug. A debug session starts and when the breakpoint is hit, the Debugger in the IDE will open and there you can step through the NetBeans Platform sources.

© Oracle Blogs or respective owner

Related posts about /NetBeans IDE