Java J2EE Portal
Enterprise Java Station
J2EE curve
Java News / Articles
Java News / Articles
Using Apache Geronimo In Real World JavaEE Applications
Using the Java ByteCode Verifier To Prevent Malicious Access
Java Cryptography : A Bird's Eye View
Processing...
Buy Java, Deals On Software Technology Store
Click here for great deals on computers, laptops, software and books
Debugging Java applications using IntelliJ IDEA PDF Print
Written by Content Team   
May 04, 2006 at 06:59 AM

IntelliJIDEADebuggingJavaThe creators of IntelliJ IDEA claim that it's the most intelligent Java IDE out there. IntelliJ IDEA is said to be obsessed with helping developers achieve their best and enjoy their work – consistently, sustainably, over time. There are 1000s of IDEA users who would vouch for that claim and who use IDEA as their preferred IDE rather than NetBeans, Eclipse or any of the other more well known IDE.

Manning recently released the book "IntelliJ IDEA In Action" and the following is an excerpt from the book. It deals with the different kind of errors encountered during development and how best to use IntelliJ IDEA to debug your Java J2EE applications. Although some portions of the excerpt are IntelliJ specific, there's a lot of info about debugging techniques and best practices, which could be useful irrespective of which IDE you use.

Adapted from: IntelliJ IDEA in Action,
written by Fields, Saunders and Belyaev
ISBN: 1932394443
Reprinted by permission of Manning Publications Co.

Debugging applications

In this chapter…

* Running programs under the IDEA debugger
* Managing breakpoints and monitoring runtime values
* Working with threads and the call stack
* Configuring the debugger

We’d all like to think that we never make mistakes. No matter how good a developer you are, if you write programs then you also write bugs—it’s an unavoidable fact of life. The question isn’t whether you’ll need to debug your program, but how you plan on going about doing it. Many beginning programmers rely on System.out.println() to show them what’s happening inside their program, but more sophisticated developers understand the benefits of using a debugging tool. The debugger included with IDEA is a powerful, easy-to-use tool for examining a running program to determine what’s happening (or not happening) behind the scenes. After reading this chapter, you’ll never need to rely on print statements again.

  • Introducing the debugging process

In this section, we’ll introduce the basic concepts of using a symbolic debugger to analyze Java programs. If you’re familiar with using such tools, and you just want to understand how the IDEA debugger works, feel free to skim ahead to the next section.

  • Finding and fixing bugs with a debugger

We must start with some bad news: A debugger can neither find nor fix bugs. If it could, we’d all have a lot more free time. No, you’ll need to find the bugs on your own, either through testing or pure luck (if you call getting big nasty stack traces lucky). Although the debugger won’t fix bugs for you, it’s immensely helpful in tracking them down and understanding what you must do to fix them.

  • A debugger is essentially a tool that can tell you what’s going on inside the Java VM as your program is executing. It lets you start your program and then walk through it, method by method or line by line, using a process known as stepping through the code. Executing your code this way lets you slow things down and monitor your application’s progress. Each step of the way, you can examine the state and contents of your application’s variables and object references. The process can answer burning questions like, “What is the value of the variable x at the start of this method?”, “Where did that null pointer exception come from?”, and “How did I get here?”

  • Once you suspect a bug is lurking in your code, it’s time to bring out the debugger. Before you begin hunting down bugs, it’s important to know exactly what you’re looking for and to have an idea where you may find it. In the wild, you’ll encounter several different species of bugs, and the debugger can help you track down all of them.




Add This Feed Button

Enter your Email

IndicThreads.com Conference On Java Technology, Pune, India
Java Expert Interviews
TitusBrown
Test Driven Development doesn't fit my brain
EclipseExecutiveDirectorMikeMilinkovich
Eclipse is focused on closing in on Visual Studio - Switching campaigns are for marke
Sameer Tyagi Sun
Understanding Web Services and SOA
Processing...
Go to top of page  Home |
SiteMap

Copyright 2004 to 2008 Rightrix Solutions. All rights reserved. All product names are trademarks of their respective companies. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Rightrix Solutions and IndicThreads.com are independent of Sun Microsystems, Inc.

Views expressed at IndicThreads.com reflect the views of the authors alone, and do not necessarily reflect those of IndicThreads.com. IndicThreads.com and it's authors are not responsible for reader comments and opinions.

Enterprise Java J2EE JEE Portal >> IndicThreads.com