⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch33.htm

📁 Java_by_Example,初级经典例子哦,珍藏版本
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<HTML><HEAD><TITLE>developer.com - Reference</TITLE><META NAME="Author" CONTENT="developer.com"><META NAME="Keywords" CONTENT="javascript, ActiveX, VRML, Push, channel,push channel, applet, directory, news, community, developer, internet,intranet, java, java applet, J++, javabeans, java products, tools, javatools, JDK, java development kit, java development environment, JIT,JavaPlan, enterprise tools, JVM, Java Virtual Machine, Java resources, API,browser, java documentation, CDF, Common Desktop Format, RDF, ResourceDescription Framework, Netcaster, Netcast, Castanet, meta-language, metadata,solaris, Solaris, SUN, CGI, Perl, Oracle, database, network, Netscape API,Apache, apache, SSL, mSQL, Netscape, Fasttrack, FastTrack,industry standard, ActiveX bridge, web, internet, site, sitedesign, microsoft, active server pages, asp, iis, nt, win95, 95, html, cgi,frontpage, business, corporate, vbscript, javascript, activex, isapi,database, access, sql, server, www, 3.0, 3.01, 3.02, 3.03, 3.04, 4.0,4.0b2, 4.01, 4.03, 4.04, connection, online, commerce, publisher,publishing, publish, webmaster, dynamic html, dhtml, windows 98, netscape,netscape software, shareware, magazines, jobs, japan, free, freeware, freestuff"><META NAME="description" CONTENT="Developer.com is the leading onlineservice for developers. It includes Gamelan, the official directory for Java, as wellas news, information, tutorials, and directories for other Internet technologiesincluding ActiveX, JavaScript, perl, VRML, Java Beans, push technologies, andother Internet and intranet technologies. Developer.com is also the home ofDeveloper Direct, the Professional Developer's Store, where developers canpurchase and download thousands of Web, authoring and other developmentproducts at some of today's lowest prices."><META NAME="distribution" CONTENT="global"><META NAME="resource-type" CONTENT="document"><META NAME="language" CONTENT="en"></HEAD><BODY BACKGROUND="/images/curve_r-wide.gif" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#DD0000" VLINK="#999999" ALINK="#FF0000"><TABLE><TR><TD VALIGN=TOP WIDTH=120><A HREF="/" ><IMG SRC="/images/masthead_r.gif" WIDTH="100" HEIGHT="78" BORDER="0"ALT="Developer.com Logo"></a></TD><TD><a target="resource window" href="http://adserver.developer.com/cgi-bin/accipiter/adclick.exe/AREA=DCBAN.REF/DT=null"><img src="http://adserver.developer.com/cgi-bin/accipiter/adserver.exe/AREA=DCBAN.REF/DT=null" HEIGHT="60" WIDTH="468" ALT="Click here to support our advertisers"><BR><CENTER>Click here to support our advertisers</CENTER></a></TD></TR></TABLE><!--outer table--><TABLE><!--outer table--><TR><!--outer table--><TD VALIGN="TOP"><!--navbar info --><table><tr><td><A HREF="http://www.developerdirect.com/" ><IMG SRC="/images/button_s.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>SHOPPING</b></font></a></td></tr><tr><td><A HREF="/community/jobs/c_jobs.html"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>JOB BANK</B></font></a></td></tr><tr><td><A HREF="http://www.classifieds2000.com/cgi-cls/display.exe?Developer+computer+searchcomputercategories"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>CLASSIFIEDS</B></font></a></td></tr><tr><td><A HREF="/directories/directories.html"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>DIRECTORIES</B></font></a></td></tr><tr><td><A HREF="/reference/"><IMG SRC="/images/button_r.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>REFERENCE</B></font></a><br><a href="/reference/r_library.html"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000">Online Library</a></font></td></tr><tr><td><A HREF="/classroom/"><IMG SRC="/images/button_r.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>LEARNING CENTER</B></font></a></td></tr><tr><td><A HREF="/journal/"><IMG SRC="/images/button_n.gif" width="15" height="11" BORDER="0"><B><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000">JOURNAL</font></B></a></td></tr><tr><td><A HREF="/news/"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>NEWS CENTRAL</b></font></a></td></tr><tr><td><A HREF="/downloads/"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>DOWNLOADS</b></font></a></td></tr><tr><td><A HREF="/community/" ><IMG SRC="/images/button_c.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><B>COMMUNITY</B></font></a></td></tr><tr><td><A HREF="/calendar/"><IMG SRC="/images/button_d.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>CALENDAR</b></font></a></td></tr><tr><td><A HREF="/about/"><IMG SRC="/images/button_a.gif" width="15" height="11" BORDER="0"><FONT FACE="Arial, Helvetica" SIZE="-1" color="#000000"><b>ABOUT US</b></a></font></td></tr></table><table><tr><td><form action="/subscribe/list.cgi" method=post ><img src="/images/rule.gif" width="100" height="2"><br><B><FONT FACE="Arial, Helvetica" SIZE="-1">Journal:</b></font><br><input name='email' value='your e-mail' size="11"><input type='hidden'  name='state' value='Subscribe'></td></tr><tr><td><input type='submit' value='Subscribe'><br><font size="-1">Get the weekly email highlights from the most popular journal for developers!<br><a href="http://www.developer.com/subscribe.html">Current issue</a><img src="/images/rule.gif" width="100" height="2"><input type='hidden' name='name' value='New Subscriber'></FORM></td></tr></table><!--/navbar--><font size="-1"><A HREF="http://www.developer.com">developer.com</a><BR><A HREF="http://www.developerdirect.com">developerdirect.com</a><BR><A HREF="http://www.htmlgoodies.com">htmlgoodies.com</a><BR><A HREF="http://www.javagoodies.com">javagoodies.com</a><br><A HREF="http://www.jars.com">jars.com</a><BR><a href="http://www.intranetjournal.com">intranetjournal.com</a><br><a href="http://www.javascripts.com">javascripts.com</a><br></font><!--outer table--></TD><!--outer table--><TD VALIGN="TOP"><BLOCKQUOTE><P><img src="/images/header_r.gif" width="440" height="50"><P><MAP NAME ="header_r2.gif.map"><AREA SHAPE ="RECT"      HREF ="/reference/author.html"      COORDS ="361,0,440,29"><AREA SHAPE ="RECT"      HREF ="/reference/basic.html"      COORDS ="254,0,360,29"><AREA SHAPE ="RECT"      HREF ="/reference/help.html"      COORDS ="183,0,251,29"><AREA SHAPE ="RECT"      HREF ="/reference/cool.html"      COORDS ="100,0,181,29"><AREA SHAPE ="RECT"      HREF ="/reference/mybook.html"      COORDS ="0,0,100,29"></MAP><MAP NAME ="header_r1.gif.map"><AREA SHAPE ="RECT"      HREF ="/reference/personalize.html"      COORDS ="339,0,439,29"></MAP><p><font face="Arial,Helvetica" size="-1" color="#006666"><A HREF="/reference/r_library.html"><B>All Categories</A> :</B><b><A HREF="/reference/r_java.html">Java</A></b></font><p><META><H1><FONT SIZE=6 COLOR=#Ff0000>Chapter&nbsp;33</FONT></H1><H1><FONT SIZE=6 COLOR=#Ff0000>Development Tools Overview</FONT></H1><HR><P><CENTER><B><FONT SIZE=5><A NAME="CONTENTS">CONTENTS</A></FONT></B></CENTER><UL><LI><A HREF="#TheTools">The Tools</A><LI><A HREF="#UsingAppletviewer">Using Appletviewer</A><UL><LI><A HREF="#ExampleLoadingMoreThanOneAppletataTime">Example: Loading More Than One Applet at a Time</A><LI><A HREF="#RunningtheDebuggerfromAppletviewer">Running the Debugger from Appletviewer</A></UL><LI><A HREF="#UsingHotJava">Using HotJava</A><LI><A HREF="#UsingJavasDocumentationcreator">Using Java's Documentation Creator</A><UL><LI><A HREF="#JavadocTags">Javadoc Tags</A><LI><A HREF="#ExampleUsingDocTags">Example: Using Doc Tags</A><LI><A HREF="#ExampleDocumentinganApplet">Example: Documenting an Applet</A><LI><A HREF="#JavadocOptions">Javadoc Options</A></UL><LI><A HREF="#UsingtheDisassembler">Using the Disassembler</A><LI><A HREF="#UsingtheCHeaderGenerator">Using the C Header Generator</A><LI><A HREF="#UsingtheDebugger">Using the Debugger</A><LI><A HREF="#Summary">Summary</A><LI><A HREF="#ReviewQuestions">Review Questions</A><LI><A HREF="#ReviewExercises">Review Exercises</A></UL><HR><P>Throughout this book, you've concentrated on building appletsfor use on Web pages. As you built these applets, you've learnedonly the very basics about Java's development tools, which includenot only the compiler (javac) and the interpreter (java), butalso several other useful tools that help you create more powerfulapplets and applications. Now that you have many hundreds of pagesof Java experience behind you, you'll probably want to know moreabout the tools you've been using (and the tools you haven't beenusing!). In this chapter, you get a quick look at the Java toolsthat come with the JDK. Because the compiler and interpreter arethe most important tools, they have their own chapters, whichfollow this chapter.<H2><A NAME="TheTools"><FONT SIZE=5 COLOR=#Ff0000>The Tools</FONT></A></H2><P>The JDK comes with several development tools, a couple of whichyou must use frequently as you develop and run applets. Others,you may never use, but it's always good to know they're thereshould you need them. Table 33.1 lists the tools and their descriptions.<BR><P><CENTER><B>Table 33.1&nbsp;&nbsp;Java Development Tools.</B></CENTER><P><CENTER><TABLE BORDER=1 WIDTH=80%><TR VALIGN=TOP><TD WIDTH=138><I><B>Tool</B></I></TD><TD WIDTH=453><I><B>Description</B></I></TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>appletviewer</TT></TD><TD WIDTH=453>This tool enables you to run Java applets without actually loading the applets into a Java-compatible browser.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>hotjava</TT></TD><TD WIDTH=453>This is the original Java-compatible Web browser.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>java</TT></TD><TD WIDTH=453>This is the Java interpreter, which runs applets and applications by reading and interpreting byte-code .CLASS files.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>javac</TT></TD><TD WIDTH=453>This is the Java compiler, which converts your Java source-code to byte-code files that the interpreter can understand.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>javadoc</TT></TD><TD WIDTH=453>This tool creates HTML-format documentation from Java source code files.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>javah</TT></TD><TD WIDTH=453>This tool produces header files for use with native methods.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>javap</TT></TD><TD WIDTH=453>This tool is the Java disassembler, which enables you to convert byte-code files into a program description.</TD></TR><TR VALIGN=TOP><TD WIDTH=138><TT>jdb</TT></TD><TD WIDTH=453>This is the Java debugger.</TD></TR></TABLE></CENTER><P><P>The two most important tools in Table 33.1 are the Java compiler,javac, and the Java interpreter, java. Because you will be usingthese tools a lot, they will be discussed in their own chapters.Specifically, for more information on javac and java, check out<A HREF="ch34.htm" >Chapter 34</A>, &quot;Using the Compiler,&quot; and <A HREF="ch35.htm" >Chapter 35</A>, &quot;Usingthe Interpreter.&quot;<H2><A NAME="UsingAppletviewer"><FONT SIZE=5 COLOR=#Ff0000>Using Appletviewer</FONT></A></H2><P>Outside of what you already know, there's not much to using theAppletviewer application. As you already know, to run an appletwith Appletviewer, you type a command line like this:<BLOCKQUOTE><PRE>appletviewer applet.html</PRE></BLOCKQUOTE><P>The <TT>appletviewer</TT> portion of the command runs Appletviewerand the command line's parameter, <TT>applet.html</TT>, is theHTML document that loads the applet you want to view. One interestingthing about Appletviewer is that you can have more than one appletin the HTML file, in which case, Appletviewer loads each of theapplets into its own window.<H3><A NAME="ExampleLoadingMoreThanOneAppletataTime">Example: Loading More Than One Applet at a Time</A></H3><P>Suppose you've been working on the applets presented in Chapter25, &quot;Mouse and Keyboard Events,&quot; and you want to testKeyApplet, MouseApplet, and MouseApplet2 all at once. No problem!Listing 33.1 is an HTML file that loads and runs these three applets.To run the applets, you would type<BLOCKQUOTE><PRE>appletviewer allapplets.html</PRE></BLOCKQUOTE><P>at your command-line prompt. When you do, you'll see a screensomething like Figure 33.1 as Appletviewer loads and runs thethree applets referenced in the HTML document.<P><A HREF="f33-1.gif"><B> Figure 33.1 : </B><I>Appletviewer can load and run several applets at once.</I></A><P><HR><BLOCKQUOTE><B>Listing 33.1&nbsp;&nbsp;ALLAPPLETS.htmL: An HTML Document ThatLoads Three Applets.<BR></B></BLOCKQUOTE><BLOCKQUOTE><PRE>&lt;title&gt;Applet Test Page&lt;/title&gt;&lt;h1&gt;Applet Test Page&lt;/h1&gt;&lt;applet    code=&quot;KeyApplet.class&quot;    width=250    height=150    name=&quot;KeyApplet&quot;&gt;&lt;/applet&gt;&lt;applet    code=&quot;MouseApplet.class&quot;    width=250    height=150    name=&quot;MouseApplet&quot;&gt;&lt;/applet&gt;&lt;applet    code=&quot;MouseApplet2.class&quot;    width=250    height=150    name=&quot;MouseApplet2&quot;&gt;&lt;/applet&gt;</PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -