advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Reverse Engineering to Peek at Java Class Source Code
Graphical Java IDEs allow breakpoints to be set visually, such as by clicking on a line of source code (which then turns red to indicate it is a breakpoint), and to change the value of variables during program execution. What others features that currently in your debugger would be useful to you?
Partners & Affiliates
advertisement
advertisement
Average Rating: 1/5 | Rate this item | 1 user has rated this item.
 Print Print
 
Use the Java Debugger to Determine the Causes of Errors
Although the Java Virtual Machine frees programmers from many low-level tasks like garbage collection, it can't protect them from mistakes in design and logic. This article explores the Java Debugger, which you can use to trace through a running program and determine the causes of any errors. 

advertisement
Debugging is an art that every successful programmer needs to master sooner rather than later. The sad truth is that program bugs appear almost as soon as you start coding. Although a Java compiler always will detect syntax errors, often code that is syntactically correct is not logically correct. These sorts of problems may require the help of a debugger.

Sun's Java Development Kit (JDK) includes a debugger called JDB (Java Debugger), a command-line application under which you can execute the programs you need to inspect. With JDB, you can inspect variables while a program is running, set breakpoints to halt the execution of a program at a certain point, and execute code line by line (known as single-stepping). You can see just how the contents of variables change after each statement of program code, and you can precisely trace the execution of a program--even as it branches to other functions or iterates through loops.

JDB can be used to debug graphical programs and applets as well. An important thing to note, though, is that the programs you debug must be compiled with the -g flag. This causes the Java compiler to insert additional debugging information into the resulting Java class file. (See the Sidebar: Reverse Engineering to Peek at Java Class Source Code for an examination of a command that disassembles Java classes so you can explore the original source code behind it.)

Page 1 of 4
advertisement
  Next Page: A Sample Debugging Session
Page 1: IntroductionPage 3: Breakpoints: The Most Useful Debugger Feature
Page 2: A Sample Debugging SessionPage 4: Effective Debugging as a Software Engineering Skill
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES