[Homepage] |
[Next: Using gdb] |
[Up: General Lab Info] |
[Prev: How to Submit]
Debugging Programs
If, when you run javac, you get a whole slew of compiler error
messages,
work on fixing the first couple of errors and then re-compile; the later error
messages probably result from javac getting confused after the first
error.
If you are on a terminal that doesn't let you scroll back to see the
first errors, you can redirect the error messages to a file by using
>&. To name the error file errs, type
``javac Prog.java >& errs''; use ``head errs'' to see
the first ten lines of that file or ``more errs'' to scroll through the file.
If things are getting really tough, you can use a debugger.
All Integrated Development Enviroments (IDEs) have built in debuggers that
are very nice.
For beginning students, the overhead of figuring out an IDE can be more
trouble than it is worth.
There is a simple debugger that comes with the standard Java Development Kit
(JDK), which we are using.
It is called jdb.
Ewerton L. Madruga
Modified by Kevin Klenk