Debugging a Console Application

   

Thanks for using this pre-release version of Visual J++.

If youÆve created a Java console application and noticed peculiar behavior when it runs, these procedures will help you debug your application.

Note   The application example for this scenario was built in Creating a Console Application. If youÆd like to create this project to complete the following exercises, do so now.

The application in this scenario accepts a calendar date passed from the command line and converts it to a Julian date. Once the dateÆs been entered, youÆll set a breakpoint and start debugging the application. YouÆll also examine the value of some member variables with the debug windows. Although there may be references to specific code statements in the Julian Date Conversion application, you can substitute code and member variables from any application and still find the procedures in this scenario helpful.

Running the application requires that a date be entered from the command line before this program runs. The steps in the procedure for Entering Command-line Arguments shows you how to pass this information to the application from the development environmentÆs Launch tab. After youÆve entered command-line arguments for your program, go to Setting a Breakpoint Before Starting the Debugger to begin the debugging session.

When execution of your application stops on a break point, view current values for your applicationÆs member variables in the Auto, Locals, Watch, and Immediate debug windows. This gives you a snapshot of whatÆs happening with your program up to the place where it entered break mode.

Now that youÆve had a chance look at the state of your program up to where it entered break mode, you may want to set another breakpoint, and then continue Stepping Through the Code.

This concludes the scenario for debugging a console application using the Julian Date Conversion application. See Basic Debugging Procedures for additional information on using the features of the integrated debugger.