26.07.2013 Views

Java How to Program Fourth Edition - DCC

Java How to Program Fourth Edition - DCC

Java How to Program Fourth Edition - DCC

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.

16 Introduction <strong>to</strong> Computers, the Internet and the Web Chapter 1<br />

<strong>Java</strong> <strong>How</strong> <strong>to</strong> <strong>Program</strong>: <strong>Fourth</strong> <strong>Edition</strong> presents programming techniques that allow<br />

<strong>Java</strong> applications <strong>to</strong> use the Internet and World Wide Web <strong>to</strong> interact with other applications.<br />

These capabilities, and the capabilities discussed in our companion book Advanced<br />

<strong>Java</strong> 2 Platform <strong>How</strong> <strong>to</strong> <strong>Program</strong>, allow <strong>Java</strong> programmers <strong>to</strong> develop the kind of enterprise-level<br />

distributed applications that are used in industry <strong>to</strong>day. <strong>Java</strong> applications can be<br />

written <strong>to</strong> execute on any computer platform, yielding major savings in systems development<br />

time and cost for corporations. If you have been hearing a great deal about the Internet<br />

and World Wide Web lately, and if you are interested in developing applications <strong>to</strong> run over<br />

the Internet and the Web, learning <strong>Java</strong> may be the key <strong>to</strong> challenging and rewarding career<br />

opportunities for you.<br />

1.13 Basics of a Typical <strong>Java</strong> Environment<br />

<strong>Java</strong> systems generally consist of several parts: An environment, the language, the <strong>Java</strong> Applications<br />

<strong>Program</strong>ming Interface (API) and various class libraries. The following discussion<br />

explains a typical <strong>Java</strong> program development environment, as shown in Fig. 1.1.<br />

<strong>Java</strong> programs normally go through five phases <strong>to</strong> be executed (Fig. 1.1). These are: edit,<br />

compile, load, verify and execute. We discuss these concepts in the context of the <strong>Java</strong> 2 Software<br />

Development Kit (J2SDK) that is included on the CD that accompanies this book. Carefully<br />

follow the installation instructions for the J2SDK provided on the CD <strong>to</strong> ensure that you<br />

set up your computer properly <strong>to</strong> compile and execute <strong>Java</strong> programs. [Note: If you are not<br />

using UNIX/Linux, Windows 95/98/ME or Windows NT/2000, refer <strong>to</strong> the manuals for your<br />

system’s <strong>Java</strong> environment or ask your instruc<strong>to</strong>r how <strong>to</strong> accomplish these tasks in your environment<br />

(which will probably be similar <strong>to</strong> the environment in Fig. 1.1).]<br />

Phase 1 consists of editing a file. This is accomplished with an edi<strong>to</strong>r program (normally<br />

known as an edi<strong>to</strong>r). The programmer types a <strong>Java</strong> program, using the edi<strong>to</strong>r, and<br />

makes corrections, if necessary. When the programmer specifies that the file in the edi<strong>to</strong>r<br />

should be saved, the program is s<strong>to</strong>red on a secondary s<strong>to</strong>rage device, such as a disk. <strong>Java</strong><br />

program file names end with the .java extension. Two edi<strong>to</strong>rs widely used on UNIX/<br />

Linux systems are vi and emacs. On Windows 95/98/ME and Windows NT/2000, simple<br />

edit programs like the DOS Edit command and the Windows Notepad will suffice. <strong>Java</strong><br />

integrated development environments (IDEs), such as Forté for <strong>Java</strong> Community <strong>Edition</strong>,<br />

NetBeans, Borland’s JBuilder, Symantec’s Visual Cafe and IBM’s VisualAge have builtin<br />

edi<strong>to</strong>rs that are integrated in<strong>to</strong> the programming environment. We assume the reader<br />

knows how <strong>to</strong> edit a file.<br />

[Note that Forté for <strong>Java</strong> Community <strong>Edition</strong> is written in <strong>Java</strong> and is free for noncommercial<br />

use. It is included on the CD accompanying this book. Sun updates this software<br />

approximately twice a year. Newer versions can be downloaded from<br />

www.sun.com/forte/ffj<br />

Forté for <strong>Java</strong> Community <strong>Edition</strong> executes on most major platforms. This book is written<br />

for any generic <strong>Java</strong> 2 development environment. It is not dependent on Forté for <strong>Java</strong><br />

Community <strong>Edition</strong>. Our example programs should operate properly with most <strong>Java</strong> integrated<br />

development environments.]<br />

In Phase 2 (discussed again in Chapters 2 and 3), the programmer gives the command<br />

javac <strong>to</strong> compile the program. The <strong>Java</strong> compiler translates the <strong>Java</strong> program in<strong>to</strong> byte-<br />

© Copyright 1992–2002 by Deitel & Associates, Inc. All Rights Reserved. 7/8/01

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

Saved successfully!

Ooh no, something went wrong!