ICOM 4035 – Data Structures

Fall 2007

 

Laboratory 1: Reviewing the Eclipse IDE

and using the Debugger

 

1.    Objectives

 

1.       Practice using the Eclipse IDE along with its Debugger with Java programs.

2.       Learn about the features of the debugger. These include: breakpoints, different kinds of stepping and variable monitoring.

3.       Learn how to track the flow control of a program with the debugger.

4.       Learn not to depend on an IDE to develop a Java program.

5.       Compile and execute java programs from the command prompt.

 

2.    Overview

 

In the previous course you learned about how to develop your Java programs using the Eclipse IDE. In this first laboratory you will concentrate on learning how to benefit from the debugger features in order to check and correct your program.

 

You already know how to perform a quick debugging by using print statements using the System.out.print function or System.err.print for standard output and standard error displays respectively. However this technique is not very reliable since eventually one will have to delete or comment these lines before releasing the software.

 

This is where the debugger comes in. By setting up breakpoints at the code one is able to tell the debugger to stop the execution of the code. After this has occurred you will be able to monitor values of variables, enter or leave functions, step into the next instruction, continue the execution or stop it.

 

Compiling using command prompt:

            javac [-verbose] [-target <version_num>] <files>.java

                        -verbose : shows what the compiler is doing

                        -target: compiles the code for the JVM version_num version.

                        files: the files to be compiled.

           

            Ex: javac –verbose *.java: compiles all java files inside of current directory.

 

Running your Java application:

            java <main class name>

           

Note: Do not add .class when running the java command.

 

To begin with you lab download source code here.