Debugging the NetBeans Platform

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.

Comments:

Of course the GUI snapshot button is only helpful if what you are debugging is the behavior of some GUI component. Often things will be more abstracted so that the code you want to debug is not in the same class or even the same module as the code which physically creates the GUI.

Posted by Jesse Glick on November 28, 2011 at 04:30 AM PST #

Hi Geertjan,

The post about debugging is nice.

I would like to know whether there is any option to set a flag whenever the state of a boolean field changes for true to false or vice-versa.

Regards,
Nigel.

Posted by Nigel Thomas on February 14, 2013 at 11:51 PM PST #

In the above question I would like to clarify that I am using NetBeans 7.0

Posted by Nigel Thomas on February 15, 2013 at 01:51 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today