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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

148Chapter 5The Sun Microsystems Java Software <str<strong>on</strong>g>Development</str<strong>on</strong>g> Kita very simplistic naming/lookup system. Clients must know where to find theregistry with the resources they need.RMI is very useful for problems of a certain scale, but it is not, in and ofitself, sufficient for high-volume, highly available, missi<strong>on</strong>-critical enterprisesystems. 22 But that is what J2EE and EJB are for. We’ll deal with those inPart V later in the book.5.9THE JAVA DEBUGGERHow can you stand using the SDK? It doesn’t even have a debugger!Wr<strong>on</strong>g. It has a debugger. It just has an extremely basic command-linedebugger. Example 5.16 shows the output of its help.Again, we are not going to document everything here. That’s what the<strong>on</strong>line Sun Microsystems Java SDK documentati<strong>on</strong> is for. Instead, we will usethe debugger to step through the executi<strong>on</strong> of our simple applicati<strong>on</strong> and showyou some of the debugger’s basic operati<strong>on</strong>s.There are two ways to invoke jdb. One is to attach it to an already runningJVM that has been started with remote debugging enabled. See the Java SDKdocumentati<strong>on</strong> for details <strong>on</strong> that method. Here we’ll show you the simplercase of invoking the program locally by running the applicati<strong>on</strong> directly underthe debugger.The basic invocati<strong>on</strong> is:$ jdbYou may opti<strong>on</strong>ally name the class whose main() is to be executed underthe debugger, but we usually use the run from inside the debugger itself to dothis. Remember that if you want to be able to view local variables in the debugger,you must have compiled your class or classes with the -g opti<strong>on</strong> of javac.In the rest of this secti<strong>on</strong>, we will examine an actual debug sessi<strong>on</strong>. Wewill run our single-class applicati<strong>on</strong>, FetchURL, and use it to retrieve theindex.html file from the Web server <strong>on</strong> the laptop <strong>on</strong> which this chapter isbeing written. To refresh your memory, remember that the source code forFetchURL is at Example 3.30. Example 5.17 is what that file looks like.22. If that sentence did not cause you to get “buzzword bingo,” then you aren’t trying.

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

Saved successfully!

Ooh no, something went wrong!