Looking Under the Hood of Your Java Application with the Java Debugger
- Compiler Errors versus Logic Errors
- What jdb Brings to the Table
- Enough Introduction...Let's Debug Already!
- Some Advanced Notes about Debugging
To err is human. Unfortunately, this adage also applies to the world of programming. In the realm of Java development, programmers typically use integrated development environments (IDEs) to peek under the hoods of their applications, being able to set breakpoints and step through their code on a line-by-line basis. Tools such as the Eclipse IDE and IBM's WebSphere Studio Application Developer have thus made the life of programmers easier and more productive.
What do you do when you need to troubleshoot your Java application and you don't have these sophisticated IDEs available to you? Are you out of luck? Not necessarily. In this article, you'll learn about jdb, the Java debugger that ships with the software development kit. You'll learn how you can use jdb to scrutinize your Java application and hopefully exterminate those logic bugs that riddle your code. As you will see, jdb allows you to look under the hood of your Java application (that is, see what is going on in the Java interpreter) during program execution. The Java debugger demonstrates the Java Platform Debugger Architecture, which is designed to allow inspection and debugging of a Java Virtual Machine.
Compiler Errors versus Logic Errors
If you are simply trying to get your Java classes to compile successfully, jdb is not really needed. You can use the compile time error messages of the Java compiler to go through your code and see what syntax is not being followed properly, thus hindering a successful compile operation (for example, unmatched brackets, missing import statements, and so on). Such errors are known as compile time errors.