13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.9 The Java Debugger151Example 5.17 index.html used in jdb sessi<strong>on</strong>RedHat <strong>Linux</strong> LaptopRedHat <strong>Linux</strong> LaptopYou have c<strong>on</strong>tacted Michael Schwarz's RedHat <strong>Linux</strong> Laptop.You would probably rathersee his permanent Webpage since this server goes up and down all the time, whatwith it being <strong>on</strong> a laptop.Example 5.18 is an actual transcript of a real jdb sessi<strong>on</strong>. It is annotatedwith explanatory comments. Our goal here is to get you going. The best wayto learn jdb, or indeed any of these tools, is to use them.Obviously, this little sessi<strong>on</strong> has merely scratched the surface of the Javadebugger. You can debug multithreaded applicati<strong>on</strong>s with commands that cansuspend and resume individual threads, list the running threads, switch your“executable view” between threads, and so forth. You can trace method calls.You can m<strong>on</strong>itor variables. You can execute expressi<strong>on</strong>s (including assignmentexpressi<strong>on</strong>s, allowing you to force variables to certain values). You can browseclasses. You can dump all local variables with a single command. The debuggeris quite capable, if a bit limited in user interface. 23 Learn it. Play with it. Stepthrough your favorite Java program with it.23. As you know, we do not automatically like IDEs and GUI development tools (see Secti<strong>on</strong>5.2). A debugger is an excepti<strong>on</strong> to that rule. When debugging, a well designed UI witha code pane, a stack pane, a data viewer, a class browser, a thread selecti<strong>on</strong> pane, and so <strong>on</strong> isenormously helpful. You need to be able to see all these elements nearly simultaneously; youneed to see the whole system as it runs. The command-line debugger makes everything you needavailable, but with a traditi<strong>on</strong>al “glass-teletype” UI that is quite awkward. By all means, learnthe CLI debugger, but then find a good Java debugger with a windowed UI of some kind. Itis hard to say which compiler UI is the best, but I think we can safely say the command-linedebugger UI is the worst! You should know it as a last resort, but use it as a last resort!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!