IDE Tutorials CSE 219 Fall 2005


  TOC: AkA Tactical Operations Center
Table of Contents: NetBeans Eclipse
Basics Tutorial NetBeans Eclipse
Debugging Tutorial NetBeans Eclipse
JUnit Testing Tutorial NetBeans Eclipse
CVS Tutorial NetBeans Eclipse
JAR Files Tutorial NetBeans Eclipse
CSE 219 HomePage

Netbeans Debugging

This tutorial is to help students get acquainted with some key concepts of debugging and how to use a debugger.

http://www.netbeans.org/

  Lets Get It Started
The first step in debugging an application is to load your application and open the file containing the code that you wish to debug.




  Configuring Runtime arguments
Now that we have our application open in netbeans we need to make sure we have the proper main class selected and that we pass any required parameters in. To do this click on file and goto projectname Properties.




  The Properties Window
In this page we can select our main class and a number of other things such as vm params and a working directory. click browse and select the main class. In our example we also need a argument to be sent to the application so we specify it in arguments.




  Setting a Breakpoint
A break point is a debugging mechanism which tells the program that when you reach this point you want to stop the program. To set a break point you goto the line of code that you wish to set it on and then click on the bluish border on the left. This will put a breakpoint on this line.




  Debugging
Now we want to actually debug the project. You can not use the normal run main project to debug since it will ignore all break points. So to debug you must click debug main project. It can be found in the run menu or as a button on the tool bar.




  Stop... Break Point Time
You may have noticed that the project has now stopped and the line with your breakpoint is green. This means that this is the line that will be executed next. You can notice we have access to the contents of our local variables and other things.




  Stepping Into
We have several operations we can perform. One of the more basic of them are the step operations. you can step into a function which means you will go to the next line of the code and if it is a function call it will now go into that function. Likewise if you want to keep stepping witout going into a function you can use step over to execute the line and move on without entereing the function.




  Step Out
Assuming we used step into to get into a function call and started debugging in there we can now use a corresponding step called step out. This will finish executing the rest of the function that you are currently in and will place you on the next line to be executed after the function.




  Time to Continue
Lets assume we are done stepping through our code and we want to finish executing the program. Well you can either click run continue or you can click the continue button on the toolbar.




  The End
Alternatly if we do not want to debug anymore and we dont want the program to end or it never does end you can just hit the finish debugging button from the toolbar or in the run menu.




  Questions Comments Complaints?
If you have any questions or a way to make the tutorials better please speak with me or email me at dquigley at ic dot sunysb dot edu



(c) David Quigley