O'Reilly logo

Java Cookbook by Ian F. Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required


My life has been touched many times by the flow of the fates bringing me into contact with the right person to show me the right thing at the right time. Steve Munroe, with whom I’ve long since lost touch, introduced me to computers -- in particular an IBM 360/30 at the Toronto Board of Education that was bigger than a living room, had 32 or 64K of memory, and had perhaps the power of a PC/XT -- in 1970. (Are you out there somewhere, Steve?) Herb Kugel took me under his wing at the University of Toronto while I was learning about the larger IBM mainframes that came later. Terry Wood and Dennis Smith at the University of Toronto introduced me to mini- and micro-computers before there was an IBM PC. On evenings and weekends, the Toronto Business Club of Toastmasters International (http://www.toastmasters.org) and Al Lambert’s Canada SCUBA School allowed me to develop my public speaking and instructional abilities. Several people at the University of Toronto, but especially Geoffrey Collyer, taught me the features and benefits of the Unix operating system at a time when I was ready to learn it.

Greg Davidson of UCSD taught the first Learning Tree course I attended, and welcomed me as a Learning Tree instructor. Years later, when the Oak language was about to be released on Sun’s web site, Greg encouraged me to write to James Gosling and find out about it. James’s reply of March 29th, 1995, that the lawyers had made them rename the language to Java and that it was “just now” available for download, is the prized first entry in my saved Java mailbox. Mike Rozek took me on as a Learning Tree course author for a Unix course and two Java courses. After Mike’s departure from the company, Francesco Zamboni, Julane Marx, and Jennifer Urick in turn provided product management of these courses. Jennifer also arranged permission for me to “reuse some code” in this book that had previously been used in my Java course notes. Finally, thanks to the many Learning Tree instructors and students who showed me ways of improving my presentations. I still teach for “The Tree” and recommend their courses for the busy developer who wants to zero in on one topic in detail over four days. Their web site is http://www.learningtree.com.

Closer to this project, Tim O’Reilly believed in “the little Lint book” when it was just a sample chapter, enabling my early entry into the circle of O’Reilly authors. Years later, Mike Loukides encouraged me to keep trying to find a Java book idea that both he and I could work with. And he stuck by me when I kept falling behind the deadlines. Mike also read the entire manuscript and made many sensible comments, some of which brought flights of fancy down to earth. Jessamyn Read turned many faxed and emailed scratchings of dubious legibility into the quality illustrations you see in this book. And many, many other talented people at O’Reilly & Associates helped put this book into the form in which you now see it.

I also must thank my reviewers, first and foremost my dear wife Betty Cerar, who may still think Java is some kind of caffeinated beverage that I drink while programming, but whose passion for clear expression and correct grammar has benefited much of my writing. Jonathan Knudsen, Andy Oram, and David Flanagan commented on the outline when it was little more than a list of chapters and recipes, and yet were able to see the kind of book it could become, and to suggest ways to make it better. Learning Tree instructor Jim Burgess read most of the book with a very critical eye on locution, formulation, and code. Bil Lewis and Mike Slinn () made helpful comments on multiple drafts of the book. Ron Hitchens () and Marc Loy carefully read the entire final draft. Editor Sue Miller helped shepherd the manuscript through the somewhat energetic final phases of production. Sarah Slocombe read the XML chapter in its entirety and made many lucid suggestions, though unfortunately time did not permit me to include all of them. Each of these people made this book better in many ways, particularly by suggesting additional recipes or revising existing ones. Any faults that remain are surely my own.

I’ve used a variety of tools and operating systems in preparing, compiling, and testing the book. The developers of OpenBSD (http://www.openbsd.org), “the proactively secure Unix-like system,” deserve thanks for making a stable and secure Unix clone that is also closer to traditional Unix than other freeware systems. I used the vi editor (vi on OpenBSD and vim on MS-Windows) while inputting the original manuscript in XML, and Adobe FrameMaker to format the documents. Each of these is an excellent tool in its own way. If you’re wondering how I got from XML to Frame, the answer will be given in Chapter 21.

No book on Java would be complete without a quadrium[4] of thanks to James Gosling for inventing the first Unix Emacs, the sc spreadsheet, the NeWS window system, and Java. Thanks also to his employer Sun Microsystems (NASDAQ SUNW) for creating not only the Java language but an incredible array of Java tools and API libraries freely available over the Internet.

Thanks to Tom and Nathan, for the Perl Cookbook. Without them I might never have come up with the format for this book.

Willi Powell of Apple Canada provided MacOS X access.

Thanks to the Tim Horton’s Donuts in Bolton, Ontario for great coffee and for not enforcing the 20-minute table limit on the weird guy with the computer.

To each and every one of you, my sincere thanks.

[4] It’s a good thing he only invented four major technologies, not five, or I’d have to rephrase that to avoid infringing on an Intel trademark.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required