home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / JBuilder8.iso / Solaris / resource / jre / man / sman1 / javadoc.1 < prev    next >
Encoding:
Text File  |  2002-09-06  |  168.1 KB  |  2,943 lines

  1. <!DOCTYPE REFENTRY PUBLIC "-//Sun Microsystems//DTD DocBook V3.0-Based SolBook Subset V2.0//EN" [
  2. <!--ArborText, Inc., 1988-1999, v.4002-->
  3. <!ENTITY % javaents SYSTEM "javaman.ent">
  4. %javaents;
  5. ]>
  6. <?Pub UDT _bookmark _target>
  7. <?Pub EntList minus bsol>
  8. <?Pub Inc>
  9. <refentry id="javadoc-1">
  10. <!--@(#)javadoc.1 1.16 01/03/14 SMI;-->
  11. <refmeta><refentrytitle>javadoc</refentrytitle><manvolnum>1</manvolnum>
  12. <refmiscinfo class="date">23 Apr 2001</refmiscinfo>
  13. <refmiscinfo class="sectdesc">&man1;</refmiscinfo>
  14. <refmiscinfo class="software">&java-release;</refmiscinfo>
  15. <refmiscinfo class="arch">generic</refmiscinfo>
  16. <refmiscinfo class="copyright"> Copyright 2001 Sun Microsystems, Inc. All
  17. rights reserved.  Copyright 2001 Sun Microsystems, Inc. Tous droits réservés.
  18. </refmiscinfo>
  19. </refmeta>
  20. <refnamediv><refname>javadoc</refname><refpurpose>Java API documentation generator
  21. </refpurpose></refnamediv>
  22. <refsynopsisdiv><title>&synp-tt;</title>
  23. <cmdsynopsis><command>javadoc</command><arg choice="opt"><replaceable>options
  24. </replaceable></arg><arg choice="opt"><replaceable>packagenames</replaceable></arg>
  25. <arg choice="opt"><replaceable>sourcefilenames</replaceable></arg><arg choice="opt"><replaceable>
  26. subpackages [pkg1:pkg2:...]</replaceable></arg><arg choice="opt"><replaceable>
  27. @argfiles</replaceable></arg>
  28. </cmdsynopsis></refsynopsisdiv>
  29. <refsect1><title>ARGUMENTS</title>
  30. <para>Arguments can be in any order.  </para>
  31. <variablelist termlength="narrow">
  32. <varlistentry><term remap="15"><replaceable>options</replaceable> </term>
  33. <listitem><para>Command-line options, as specified in this document. To see
  34. a typical use of <command>javadoc</command> options, see <literal>Real World
  35. Example</literal>.</para>
  36. </listitem></varlistentry>
  37. <varlistentry><term><replaceable>packagenames</replaceable> </term><listitem>
  38. <para>A series of names of packages, separated by spaces, such as <literal>
  39. java.lang java.lang.reflect java.awt</literal>. You must separately specify
  40. each package you want to document. The Javadoc tool uses <option>sourcepath
  41. </option> to look for these package names. The Javadoc tool does not recursively
  42. traverse subpackages. Wildcards such as asterisks (<literal>*</literal>) are
  43. not allowed. See &exam-tt;, <literal>Documenting One or More Packages</literal>.
  44. </para>
  45. </listitem></varlistentry>
  46. <varlistentry><term><replaceable>sourcefilenames</replaceable> </term><listitem>
  47. <para>A series of source file names, separated by spaces, each of which canbegin
  48. with a path and contain a wildcard such as asterisk (<literal>*</literal>).
  49. The Javadoc tool will process every file whose name ends with <literal>.java
  50. </literal>, and whose name, when stripped of that suffix, is actually a legal
  51. class name (see <literal>Identifiers</literal>). Therefore, you can name files
  52. with dashes (such as <literal>X-Buffer</literal>), or other illegl characters,
  53. to prevent them from being documented. This is useful for test files and files
  54. generated from templates. The path that precedes the source file name determines
  55. where <command>javadoc</command> will look for it. (The Javadoc tool does
  56. not use <option>sourcepath</option> to look for these source file names.)
  57. For example, passing in <literal>Button.java</literal> is identical to <literal>
  58. ./Button.java</literal>. An example source file name with a full path is <literal>
  59. /home/src/java/awt/Graphics*.java</literal>. See &exam-tt;, <literal>Documenting
  60. One or More Classes</literal>. You can also mix  <replaceable>packagenames
  61. </replaceable> and <replaceable>sourcefilenames</replaceable>, as in &exam-tt;, <literal>
  62. Documenting Both Packages and Classes</literal>.</para>
  63. </listitem></varlistentry>
  64. <varlistentry><term><replaceable>subpackages pkg1:pkg2:...</replaceable></term>
  65. <listitem><para>Generates documentation from source files in the specified
  66. packages and recursively in their subpackages. An alternative to supplying
  67. packagenames or sourcefilenames. </para>
  68. </listitem></varlistentry>
  69. <varlistentry><term><replaceable>@argfiles</replaceable> </term><listitem>
  70. <para>One or more files that contain a list of Javadoc options, <replaceable>
  71. packagenames</replaceable> and <replaceable>sourcefilenames</replaceable>
  72. in any order. Wildcards (<literal>*</literal>) and <replaceable>-J</replaceable>
  73. options are not allowed in these files. </para>
  74. </listitem></varlistentry>
  75. </variablelist></refsect1>
  76. <refsect1><title>&desc-tt;</title>
  77. <para>The Javdoc tool parses the declarations and documentation comments in
  78. a set of Java source files and produces a corresponding set of HTML pages
  79. describing (by default) the public and protected classes, nested classes (but
  80. not anonymous inner classes), interfaces, constructors, methods, and fields.
  81. </para>
  82. <para>You can run the Javadoc tool on entire packages, individual source files,
  83. or both. In the first case, you pass in as an argument to <command>javadoc
  84. </command> a series of package names. In the second case, you pass in a series
  85. of source (<literal>.java</literal>) file names. &exam-tt; are given at the
  86. end of this document.</para>
  87. <para><emphasis>Note</emphasis>: When you pass in package names to the Javadoc
  88. tool, it currently processes all <literal>.java</literal> classes in the specified
  89. package directories, even if the <literal>.java</literal> files are code examples
  90. or other classes that are not actually members of the specified packages.
  91. It does not parse each <literal>.java</literal> file for a package declaration;
  92. we may add this parsing in a future release.</para>
  93. <para>During a run, the Javadoc tool automatically adds cross-reference links
  94. to package, class and member names that are being documented as part of that
  95. run. Links appear in several places: <itemizedlist>
  96. <listitem><para>Declarations (return types, argument types, field types) 
  97. </para></listitem>
  98. <listitem><para>"See Also" sections generated from<literal> @see</literal>
  99. tags</para></listitem>
  100. <listitem><para>In-line text generated from<literal> {@link}</literal> tags 
  101. </para></listitem>
  102. <listitem><para>Exception names generated from <literal>@throws</literal>
  103. tags </para></listitem>
  104. <listitem><para><literal>Specified by</literal> links to members in interfaces
  105. and <literal>Overrides links</literal> to members in classes </para></listitem>
  106. <listitem><para>Summary tables listing packages, classes and members </para>
  107. </listitem>
  108. <listitem><para>Package and class inheritance trees </para></listitem>
  109. <listitem><para>The index </para></listitem>
  110. </itemizedlist></para>
  111. <para>You can add hyperlinks to existing text for classes not included on
  112. the command line (but generated separately) by way of the<literal> link</literal>
  113. and<literal> linkoffline</literal> options. </para>
  114. <para>The Javadoc tool produces one complete document each time it is run;
  115. it cannot do incremental builds — that is, it cannot modify or <emphasis>
  116. directly</emphasis> incorporate results from previous runs of the Javadoc
  117. tool. However, it can link to results from previous runs, as just mentioned.
  118. </para>
  119. <para>As implemented, the Javadoc tool requires and relies on the java compiler
  120. to do its job. The Javadoc tool calls part of <command>javac</command> to
  121. compile the declarations, ignoring the member implementation. It builds a
  122. rich internal representation of the classes, including the class hierarchy,
  123. and "use" relationships, then generates the HTML from that. <command>javadoc
  124. </command> also picks up user-supplied documentation from documentation comments
  125. in the source code.</para>
  126. <para>In fact, the Javadoc tool will run on <literal>.java</literal> source
  127. files that are pure stub files with no method bodies. This means you can write
  128. documentation comments and run the Javadoc tool in the earliest stages of
  129. design while creating the <acronym>API</acronym>, before writing the implementation.
  130. </para>
  131. <para>Relying on the compiler ensures that the HTML output corresponds exactly
  132. with the actual implementation, which may rely on implicit, rather than explicit,
  133. source code. For example, the Javadoc tool will document default constructors
  134. (section 8.6.7 of Java Language Specification) that are present in the <literal>
  135. .class</literal> files but not in the source code.</para>
  136. <para>In many cases, the Javadoc tool allows you to generate documentation
  137. for source files whose code is incomplete or erroneous. This is a benefit
  138. that enables you to generate documentation before all debugging and troubleshooting
  139. is done. For example, according to the       Java Language Specification,
  140. a class that contains an abstract method should itself be declared abstract.
  141. The Javadoc tool does not check for this, and would proceed without a warning,
  142. whereas the javac compiler stops on this error. The Javadoc tool does do some
  143. primitive checking of doc comments. Use the DocCheck doclet to check the doc
  144. comments more thoroughly. </para>
  145. <para>When the Javadoc tool builds its internal structure for the documentation,
  146. it loads all referenced classes. Because of this, the Javadoc tool must be
  147. able to find all referenced classes, whether bootstrap classes, extensions,
  148. or user classes. For more about this, see <literal>How Classes are Found</literal>.
  149. Generally speaking, classes you create must either be loaded as an extension
  150. or in the class path of <command>javadoc</command>.</para>
  151. <refsect2>
  152. <title>javadoc Doclets</title>
  153. <para>You can customize the content and format of  the Javadoc tool's output
  154. by using doclets. The Javadoc tool has a default "built-in" doclet, called
  155. the standard doclet, that generates HTML-formatted <acronym>API</acronym>
  156. documentation. You can modify or subclass the standard doclet, or write your
  157. own doclet to generate HTML, XML, MIF, RTF or whatever output format you'd
  158. like. Information about doclets and their use is at the following locations:
  159. </para>
  160. <itemizedlist>
  161. <listitem><para><command>Javadoc</command> Doclets</para></listitem>
  162. <listitem><para>The <option>doclet</option> command-line option</para></listitem>
  163. </itemizedlist>
  164. <para>When a custom doclet is not specified with the <option>doclet</option>
  165. command line option, the Javadoc tool will use the default standard doclet.
  166. The Javadoc tool has several command line options that are available regardless
  167. of which doclet is being used. The standard doclet adds a supplementary set
  168. of command line options. Both sets of options are described below in the options
  169. section.</para>
  170. </refsect2>
  171. <refsect2>
  172. <title>Related Documentation and Doclets</title>
  173. <itemizedlist>
  174. <listitem><para><literal>Javadoc Enhancements</literal> for details about
  175. improvements added in Javadoc 1.4. </para></listitem>
  176. <listitem><para><literal>Javadoc FAQ</literal> for answers to common questions,
  177. information about Javadoc-related tools, and workarounds for bugs. </para>
  178. </listitem>
  179. <listitem><para><literal>How to Write Doc Comments for Javadoc</literal> for
  180. more information about Sun conventions for writing documentation comments. 
  181. </para></listitem>
  182. <listitem><para><literal>Requirements for Writing API Specifications</literal>
  183. - Standard requirements used when writing the Java 2 Platform Specification.
  184. It can be useful whether you are writing API specifications in source file
  185. documentation comments or in other formats. It covers requirements for packages,
  186. classes, interfaces, fields and methods to satisfy testable assertions. </para>
  187. </listitem>
  188. <listitem><para><literal>Documentation Comment Specification</literal> - The
  189. original specification on documentation comments, Chapter 18, Documentation
  190. Comments, in the Java Language Specification, First Edition, by James Gosling,
  191. Bill Joy, and Guy Steele. (This             chapter was removed from the second
  192. edition.) </para></listitem>
  193. <listitem><para><literal>DocCheck Doclet</literal> - Checks doc comments in
  194. source files and             generates a report listing the errors and irregularities
  195. it finds. It is part of the Sun Doc Check Utilities. </para></listitem>
  196. <listitem><para><literal>MIF Doclet</literal> - Can automate the generation
  197. of API documentation in MIF, FrameMaker and PDF formats. MIF is Adobe FrameMaker's
  198. interchange format. </para></listitem>
  199. </itemizedlist>
  200. </refsect2>
  201. <refsect2>
  202. <title>Terminology</title>
  203. <para>A few terms have specific meanings within the context of the Javadoc
  204. tool:: </para>
  205. <variablelist termlength="medium">
  206. <varlistentry><term remap="20">generated document</term><listitem><para>The
  207. document generated by the <command>javadoc</command> tool from the doc comments
  208. in Java source code. The default generated document is in HTML and is created
  209. by the standard doclet.</para>
  210. </listitem></varlistentry>
  211. <varlistentry><term>name</term><listitem><para>A name in the Java Language,
  212. namely the name of a package, class, interface, field, constructor, or method.
  213. A name can be fully-qualified, such as <literal>java.lang.String.equals(java.lang.Object)
  214. </literal>, or partially-qualified, such as <literal>equals(Object)</literal>.
  215. </para>
  216. </listitem></varlistentry>
  217. <varlistentry><term>documented classes</term><listitem><para>The classes and
  218. interfaces for which full documentation is generated during a <command>javadoc
  219. </command> run. To be documented, the source files must be available, and
  220. either their source filenames or package names must be passed into the <command>
  221. javadoc</command> command. We also refer to these as the classes included
  222. in the <command>javadoc</command> run, or the included classes.</para>
  223. </listitem></varlistentry>
  224. <varlistentry><term>excluded classes</term><listitem><para>Classes and interfaces
  225. whose source filenames or package names are not passed into the <command>
  226. javadoc</command> command.</para>
  227. </listitem></varlistentry>
  228. <varlistentry><term>referenced classes</term><listitem><para>The classes and
  229. interfaces that are explicitly referred to in the definition (implementation)
  230. or doc comments of the documented classes and interfaces. Examples of references
  231. include return type, parameter type, cast type, extended class, implemented
  232. interface, imported classes, classes used in method bodies, <literal>@see
  233. </literal>,<literal> {@link}</literal>, <literal>{@linkplain}</literal>, and<literal>
  234.  {@inheritDoc}</literal> tags. (Notice that this definition has changed since
  235. 1.3.) When the Javadoc too is run, it should load into memory all of the referenced
  236. classes in the javadoc's bootclasspath and classpath. (The Javadoc tool prints
  237. a "Class not found" warning for referenced classes not found.) The Javadoc
  238. tool can derive enough information from the <literal>.class</literal> files
  239. to determine their existence and the fully qualified names of their members.
  240. </para>
  241. </listitem></varlistentry>
  242. <varlistentry><term>external referenced classes</term><listitem><para>The
  243. referenced classes whose documentation is not being generated during a <command>
  244. javadoc</command> run. In other words, these classes are not passed into the
  245. Javadoc tool on the command line. Links in the generated documentation to
  246. those classes are said to be external references or external links. For example,
  247. if you run the Javadoc tool on only the <literal>java.awt</literal> package,
  248. then any class in <literal>java.lang</literal>, such as Object, is an external
  249. referenced class. External referenced classes can be linked to using the <option>
  250. link</option>and <option>linkoffline</option>options.An important property
  251. of an external             referenced class is that its source comments are
  252. normally not available to the Javadoc run. In this case, these comments cannot
  253. be inherited. </para>
  254. </listitem></varlistentry>
  255. </variablelist></refsect2>
  256. <refsect2>
  257. <title>Source Files</title>
  258. <para>The Javadoc tool generates output originating from four different types
  259. of "source" files: Java language source files for classes (<literal>.java
  260. </literal>), package comment files, overview comment files, and miscellaneous
  261. unprocessed files.</para>
  262. </refsect2>
  263. <refsect2>
  264. <title>Class Source Code Files</title>
  265. <para>Each class or interface and its members can have their own documentation
  266. comments, contained in a <literal>.java</literal> file. For more details about
  267. these doc commments, see <literal>Documentation Comments</literal>.</para>
  268. </refsect2>
  269. <refsect2>
  270. <title>Package Comment Files</title>
  271. <para>Each package can have its own documentation comment, contained in its
  272. own "source" file, that the Javadoc tool will merge into the package summary
  273. page that it generates. You typically include in this comment any documentation
  274. that applies to the entire package.</para>
  275. <para>To create a package comment file, you must name it  <literal>package.html
  276. </literal> and place it in the package directory in the source tree along
  277. with the <literal>.java</literal> files. The Javadoc tool will automatically
  278. look for this filename in this location. Notice that the filename is identical
  279. for all packages. For explicit details, see the example of <literal>package.html
  280. </literal>. </para>
  281. <para>The content of the package comment file is one big documentation comment,
  282. written in HTML, like all other comments, with one exception: the documentation
  283. comment should not include the comment separators /** and */ or leading asterisks.
  284. When writing the comment, you should make the first sentence a summary about
  285. the package, and not put a title or any other text between <literal><body>
  286. </literal> and the first sentence. You can include package tags. As with any
  287. documentation comment, all tags except {<literal>@link</literal>} must appear
  288. after the description. If you add a <literal>@see</literal> tag in a package
  289. comment file, it must have a fully qualified name.</para>
  290. <para>When the Javadoc tool runs, it will automatically look for this file;
  291. if found, the Javadoc tool does the following:</para>
  292. <itemizedlist>
  293. <listitem><para>Copies all content between <literal><body></literal> and
  294.  <literal></body></literal> tags for processing.</para></listitem>
  295. <listitem><para>Processes any package tags that are present.</para></listitem>
  296. <listitem><para>Inserts the processed text at the bottom of the package summary
  297. page it generates, as shown in Package Summary.</para></listitem>
  298. <listitem><para>Copies the first sentence of the package comment to the top
  299. of the package summary page. It also adds the package name and this first
  300. sentence to the list of packages on the overview page, as shown in <literal>
  301. Overview Summary</literal>. The end-of-sentence is determined by the same
  302. rules used for the end of the first sentence of class and member descriptions.
  303. </para></listitem>
  304. </itemizedlist>
  305. </refsect2>
  306. <refsect2>
  307. <title>Overview Comment File</title>
  308. <para>Each application or set of packages that you are documenting can have
  309. its own overview documentation comment, kept in its own "source" file, that
  310. the Javadoc tool will merge into the overview page that it generates. You
  311. typically include in this comment any documentation that applies to the entire
  312. application or set of packages.</para>
  313. <para>To create an overview comment file, you can name the file anything you
  314. want, typically <literal>overview.html</literal>, and place it anywhere, typically
  315. at the top level of the source tree. Notice you can have multiple overview
  316. comment files for the same set of source files, in case you want to run <command>
  317. javadoc</command> multiple times on different sets of packages. For example,
  318. if the source files for the <literal>java.applet</literal> package are contained
  319. in <literal>/home/user/src/java/applet</literal> directory, you could create
  320. an overview comment file at <literal>/home/user/src/overview.html</literal>.
  321. </para>
  322. <para>The content of the overview comment file is one big documentation comment,
  323. written in HTML, like the package comment file described previously. See that
  324. description for details. See that description for details. To reiterate, when
  325. writing the comment, you should make the first sentence a summary about the
  326. application or set of packages, and not put a title or any other text between
  327.  <literal><body></literal> and the first sentence. You can include overview
  328. tags; as with any documentation comment, all tags except in-line tags, such
  329. as {<literal>@link</literal>} must appear after the description. If you add
  330. a <literal>@see</literal> tag, it must have a fully-qualified name.</para>
  331. <para>When you run the Javadoc tool, you specify the overview comment file
  332. name with the <option>overview</option> option. The file is then processed,
  333. similar to that of a package comment file:</para>
  334. <itemizedlist>
  335. <listitem><para>Copies all content between  <literal><body></literal> and
  336.  <literal></body></literal> tags for processing.</para></listitem>
  337. <listitem><para>Processes any overview tags that are present.</para></listitem>
  338. <listitem><para>Inserts the processed text at the bottom of the overview page
  339. it generates, as shown in <literal>Overview Summary</literal>.</para></listitem>
  340. <listitem><para>Copies the first sentence of the overview comment to the top
  341. of the overview summary page.</para></listitem>
  342. </itemizedlist>
  343. </refsect2>
  344. <refsect2>
  345. <title>Miscellaneous Unprocessed Files</title>
  346. <para>You can also include in your source any miscellaneous files that you
  347. want the Javadoc tool to copy to the destination directory. These typically
  348. include graphic files, example Java source (<literal>.java</literal>) and
  349. class (<literal>.class</literal>) files, and self-standing HTML files whose
  350. content would overwhelm the documentation comment of a normal Java source
  351. file.</para>
  352. <para>To include unprocessed files, put them in a directory called <literal>
  353. doc-files</literal>, which can be a subdirectory of any package directory.
  354. You can have one such subdirectory for each package. You might include images,
  355. example code, source files, <literal>.class</literal> files, applets, and
  356. HTML files. For example, if you want to include the image of a button <literal>
  357. button.gif</literal> in the  <literal>java.awt.Button</literal> class documentation,
  358. you place that file in the <literal>/home/user/src/java/awt/doc-files/</literal>
  359. directory. Notice the <literal>doc-files</literal> directory should not be
  360. located at <literal>/home/user/src/java/doc-files</literal> because <literal>
  361. java</literal> is not a package -- that is, it does not directly contain any
  362. source files. </para>
  363. <para>All links to these unprocessed files must be hard-coded, because the
  364. Javadoc tool does not look at the file — it simply copies the directory
  365. and all its contents to the destination. For example, the link in the <literal>
  366. Button.java</literal> doc comment might look like this:<informalexample>
  367. <screen><userinput>/**
  368. * This button looks like this:
  369. * <img src="doc-files/Button.gif">
  370. */</userinput></screen>
  371. </informalexample></para>
  372. </refsect2>
  373. <refsect2>
  374. <title>Generated Files</title>
  375. <para>By default, <command>javadoc</command> uses a standard doclet that generates
  376. HTML-formatted documentation. This doclet generates the following kinds of
  377. files (where each HTML "page" corresponds to a separate file). Note that <command>
  378. javadoc</command> generates files with two types of names: those named after
  379. classes/interfaces, and those that are not (such as <literal>package-summary.html
  380. </literal>). Files in the latter group contain hyphens to prevent file name
  381. conflicts with those in the former group.</para>
  382. </refsect2>
  383. <refsect2>
  384. <title>Basic Content Pages</title>
  385. <itemizedlist>
  386. <listitem><para>One class or interface page (<literal>classname.html</literal>)
  387. for each class or interface it is documenting.</para></listitem>
  388. <listitem><para>One package page (<literal>package-summary.html</literal>)
  389. for each package it is documenting. The Javadoc tool will include any HTML
  390. text provided in a file named  <literal>package.html</literal> in the package
  391. directory of the source tree.</para></listitem>
  392. <listitem><para>One overview page (<literal>overview-summary.html</literal>)
  393. for the entire set of packages. This is the front page of the generated document.
  394. The Javadoc tool will include any HTML text provided in a file specified with
  395. the <option>overview</option> option. Note that this file is created only
  396. if you pass into <command>javadoc</command> two or more package names. For
  397. further explanation, see <literal>HTML Frames</literal>.</para></listitem>
  398. </itemizedlist>
  399. </refsect2>
  400. <refsect2>
  401. <title>Cross-Reference Pages</title>
  402. <itemizedlist>
  403. <listitem><para>One class hierarchy page for the entire set of packages (<literal>
  404. overview-tree.html</literal>). To view this, click on "Overview" in the navigation
  405. bar, then click on "Tree".</para></listitem>
  406. <listitem><para>One class hierarchy page for each package (<literal>package-tree.html
  407. </literal>). To view this, go to a particular package, class or interface
  408. page; click "Tree" to display the hierarchy for that package.</para></listitem>
  409. <listitem><para>One "use" page for each package (<literal>package-use.html
  410. </literal>) and a separate one for each class and interface (<literal>class-use/classname.html
  411. </literal>). This page describes what packages, classes, methods, constructors,
  412. and fields use any part of the given class, interface, or package. Given a
  413. class or interface A, its "use" page includes subclasses of A, fields declared
  414. as A, methods that return A, and methods and constructors with parameters
  415. of type A. You can access this page by first going to the package, class,
  416. or interface, then clicking on the "Use" link in the navigation bar.</para>
  417. </listitem>
  418. <listitem><para>A deprecated <acronym>API</acronym> page (<literal>deprecated-list.html
  419. </literal>) listing all deprecated names. (A deprecated name is not recommended
  420. for use, generally due to improvements, and a replacement name is usually
  421. given. Deprecated <acronym>API</acronym>s might be removed in future implementations.)
  422. </para></listitem>
  423. <listitem><para>A constant field values page (<literal>constant-values.html
  424. </literal>) for the values of static fields. </para></listitem>
  425. <listitem><para>A serialized form page (<literal>serialized-form.html</literal>)
  426. for information about serializable and externalizable classes. Each such class
  427. has a description of its serialization fields and methods. This information
  428. is of interest to re-implementors, not to developers using the <acronym>API
  429. </acronym>. While there is no link in the navigation bar, you can get to this
  430. information by going to any serialized class and clicking "Serialized Form"
  431. in the "See also" section of the class description. The standard doclet automatically
  432. generates a serialized             form page: any class (<literal>public</literal>
  433. or <literal>non-public</literal>) that implements<literal> Serializable</literal>
  434. is included, along with             <literal>readObject</literal> and <literal>
  435. writeObject</literal> methods, the fields that are serialized, and the doc
  436. comments from the             <literal>@serial</literal>, <literal>@serialField
  437. </literal>, and <literal>@serialData</literal> tags. Public serializable classes
  438. can be excluded by marking them (or their package) with<literal> @serial exclude
  439. </literal>, and package-private serializable classes can be included by marking
  440. them (or their package) with <literal>@serial include</literal>. As of 1.4,
  441. you can generate the complete serialized form for public and private classes
  442. by running javadoc without specifying the <option>private</option> option. 
  443. </para></listitem>
  444. <listitem><para>An index (<literal>index-*.html</literal>) of all class, interface,
  445. constructor, field and method names, alphabetically arranged. This is internationalized
  446. for Unicode and can be generated as a single file or as a separate file for
  447. each starting character (such as A-Z for English).</para></listitem>
  448. </itemizedlist>
  449. </refsect2>
  450. <refsect2>
  451. <title>Support Files</title>
  452. <itemizedlist>
  453. <listitem><para>A help page (<literal>help-doc.html</literal>) that describes
  454. the navigation bar and the above pages. You can provide your own custom help
  455. file to override the default using <option>helpfile</option>.</para></listitem>
  456. <listitem><para>One <literal>index.html</literal> file that creates the HTML
  457. frames for display. This is the file you load to display the front page with
  458. frames. This file itself contains no text content.</para></listitem>
  459. <listitem><para>Several frame files (<literal>*-frame.html</literal>) containing
  460. lists of packages, classes and interfaces, used when HTML frames are being
  461. displayed.</para></listitem>
  462. <listitem><para>A package list file (<literal>package-list</literal>), used
  463. by the <option>link</option> and <option>linkoffline</option> options. This
  464. is a text file, not HTML, and is not reachable through any links.</para></listitem>
  465. <listitem><para>A style sheet file (<literal>stylesheet.css</literal>) that
  466. controls a limited amount of color, font family, font size, font style, and
  467. positioning on the generated pages.</para></listitem>
  468. <listitem><para>A doc-files directory that holds any image, example, source
  469. code, or other files that you want copied to the destination directory. These
  470. files are not processed by the Javadoc tool in any manner — that is,
  471. any <command>javadoc</command> tags in them will be ignored. This directory
  472. is not generated unless it exists in the source tree.</para></listitem>
  473. </itemizedlist>
  474. </refsect2>
  475. <refsect2>
  476. <title>HTML Frames</title>
  477. <para>The Javadoc tool generates either two or three HTML frames, as shown
  478. in the figure below. When you pass source files (*<literal>.java</literal>)
  479. or a single package name as arguments into the <command>javadoc</command>
  480. command, it will create only one frame (C) in the left-hand column, that is,
  481. the list of classes. When you pass into <command>javadoc</command> two or
  482. more package names, it creates a third frame (P) listing all packages, as
  483. well as an overview page (Detail). This overview page has the file name, <literal>
  484. overview-summary.html</literal>. Thus, this file is created only if you pass
  485. in two or more package names. You can bypass frames by clicking on the "No
  486. Frames" link or entering at  <literal>overview-summary.html</literal>.</para>
  487. <para>If you are unfamiliar with HTML frames, you should be aware that frames
  488. can have focus for printing and scrolling. To give a frame focus, click on
  489. it. Then, on many browsers the arrow keys and page keys will scroll that frame,
  490. and the print menu command will print it.</para>
  491. <para><screen>    ------------                  ------------
  492.     |C| Detail |                  |P| Detail |
  493.     | |        |                  | |        |
  494.     | |        |                  |-|        |
  495.     | |        |                  |C|        |
  496.     | |        |                  | |        |
  497.     | |        |                  | |        |
  498.     ------------                  ------------
  499.    javadoc *.java           javadoc java.lang java.awt</screen></para>
  500. <para>Load one of the following two files as the starting page depending on
  501. whether you want HTML frames or not:</para>
  502. <itemizedlist>
  503. <listitem><para><literal>index.html</literal> (for frames)</para></listitem>
  504. <listitem><para><literal>overview-summary.html</literal> (for no frames)</para>
  505. </listitem>
  506. </itemizedlist>
  507. </refsect2>
  508. <refsect2>
  509. <title>Generated File Structure</title>
  510. <para>The generated class and interface files are organized in the same directory
  511. hierarchy as Java source files and class files. This structure is one directory
  512. per subpackage.</para>
  513. <para>For example, the document generated for the class <literal>java.applet.Applet
  514. </literal> would be located at <literal>java/applet/Applet.html</literal>.
  515. The file structure for the <literal>java.applet</literal> package follows,
  516. given that the destination directory is named <literal>apidocs</literal>.
  517. All files that contain the word "frame" appear in the upper-left or lower-left
  518. frames, as noted. All other HTML files appear in the right-hand frame.</para>
  519. <para><emphasis>Note:</emphasis> Directories are shown in bold. The asterisks
  520. (*) indicate the files and directories that are omitted when the arguments
  521. to <command>javadoc</command> are source file names (*<literal>.java</literal>)
  522. rather than package names. Also, when arguments are source file names, <literal>
  523. package-list</literal> is created but is empty. The <literal>doc-files</literal>
  524. directory will not be created in the destination unless it exists in the source
  525. tree.</para>
  526. <para><screen>apidocs                         Top directory
  527.    index.html                   Initial page that sets up HTML frames
  528.  * overview-summary.html        Lists all packages with first sentence summaries
  529.    overview-tree.html           Lists class hierarchy for all packages
  530.    deprecated-list.html         Lists deprecated API for all packages
  531.    serialized-form.html         Lists serialized form for all packages
  532.  * overview-frame.html          Lists all packages, used in upper-left frame
  533.    allclasses-frame.html        Lists all classes for all packages,
  534.                                      used in lower-left frame
  535.    help-doc.html                Lists user help for how these pages are
  536.                                      organized
  537.    index-all.html               Default index created
  538.                                      without -splitindex option
  539.    index-files                  Directory created with -splitindex option
  540.      index-<number>.html        Index files created with -splitindex option
  541.    package-list                 Lists package names, used only for resolving
  542.                                      external refs
  543.    stylesheet.css               HTML style sheet for defining fonts,
  544.                                      colors and positions
  545.    java                         Package directory
  546.      applet                     Subpackage directory
  547.        Applet.html              Page for Applet class
  548.        AppletContext.html       Page for AppletContext interface
  549.        AppletStub.html          Page for AppletStub interface
  550.        AudioClip.html           Page for AudioClip interface
  551.      * package-summary.html     Lists classes with first sentence summaries
  552.                                      for this package
  553.      * package-frame.html       Lists classes in this package, used in lower
  554.                                      left-hand frame
  555.      * package-tree.html        Lists class hierarchy for this package
  556.        package-use              Lists where this package is used
  557.        doc-files                Directory holding image and example files
  558.        class-use                Directory holding pages API is used
  559.             Applet.html         Page for uses of Applet class
  560.             AppletContext.html  Page for uses of AppletContext interface
  561.             AppletStub.html     Page for uses of AppletStub interface
  562.                 AudioClip.html         Page for uses of AudioClip
  563.     src-html                            Source code directory
  564.         java                            Package directory
  565.             applet                        Subpackage directory
  566.                 Applet.html            Page for Applet source code
  567.                 AppletContext.html    Page for AppletContext source code
  568.                 AppletStub.html        Page for AppletStub source code
  569.                 AudioClip.html        Page for AudioClip source code</screen></para>
  570. </refsect2>
  571. <refsect2>
  572. <title>Generated API Declarations</title>
  573. <para>The Javadoc tool generates a declaration at the start of each class,
  574. interface, field, constructor, and method description. This declaration is
  575. the declaration for that <acronym>API</acronym> item. For example, the declaration
  576. for the Boolean class is:<informalexample>
  577. <screen>public final class Boolean
  578. extends Object
  579. implements Serializable </screen>
  580. </informalexample>and the declaration for the <literal>Boolean.valueOfmethod
  581. </literal> is:<informalexample>
  582. <screen>public static Boolean valueOf(String s) </screen>
  583. </informalexample></para>
  584. <para>The Javadoc tool can include the modifiers <literal>public</literal>, <literal>
  585. protected</literal>, <literal>private</literal>, <literal>abstract</literal>, <literal>
  586. final</literal>, <literal>static</literal>, <literal>transient</literal>,
  587. and <literal>volatile</literal>, but not <literal>synchronized</literal> or <literal>
  588. native</literal>. These last two modifiers are considered implementation detail
  589. and not part of the <acronym>API</acronym> specification.</para>
  590. <para>Rather than relying on the keyword <literal>synchronized</literal>, <acronym>
  591. API</acronym>s should document their concurrency semantics in the comment
  592. description, as in "a single <literal>Enumeration</literal> cannot be used
  593. by multiple threads concurrently". The document should not describe how to
  594. achieve these semantics. As another example, while <literal>Hashtable</literal>
  595. should be thread-safe, there's no reason to specify that we achieve this by
  596. synchronizing all of its exported methods. We should reserve the right to
  597. synchronize internally at the bucket level, thus offering higher concurrency.
  598. </para>
  599. </refsect2>
  600. <refsect2>
  601. <title>Documentation Comments</title>
  602. <para>The original "Documentation Comment Specification" can be found under
  603. related documentation. </para>
  604. <para><emphasis>Commenting the Source Code</emphasis></para>
  605. <para>You can include documentation comments (“doc comments”)
  606. in the source code, ahead of declarations for any classs, interface, method,
  607. constructor, or field. You can also create doc comments for each package and
  608. another one for the overview, though their syntax is slightly different. Doc
  609. comments are also known as Javadoc comments. A doc comment consists of the
  610. characters between the characters <literal>/**</literal> that begin the comment
  611. and the characters <literal>*/</literal> that end it. Leading asterisks are
  612. allowed on each line and are described further below. The text in a comment
  613. can continue onto multiple lines.<informalexample><para><screen>/**
  614. * This is the typical format of a simple documentation comment
  615. * that spans two lines.
  616. */</screen></para>
  617. </informalexample></para>
  618. <para>To save space you can put a comment on one line:<informalexample><para><screen>
  619. /** This comment takes up only one line. */</screen></para>
  620. </informalexample></para>
  621. <para><emphasis>Placement of Comments</emphasis></para>
  622. <para>Documentation comments are recognized only when placed immediately before
  623. class, interface, constructor, method, or field declarations — see the
  624. class example, method example, and field example. Documentation comments placed
  625. in the body of a method are ignored. Only one documentation comment per declaration
  626. statement is recognized by the <command>javadoc</command> tool.</para>
  627. <para>A common mistake is to put an import statement between the class comment
  628. and the class declaration. Avoid this, as the Javadoc tool will ignore the
  629. class comment.<informalexample><para><screen>/**
  630. * This is the class comment for the class Whatever.
  631. */
  632.  
  633. import com.sun;   // MISTAKE - Important not to put statements here
  634.  
  635. public class Whatever {
  636. }</screen></para>
  637. </informalexample></para>
  638. <para><emphasis>A comment is a description followed by a tag section</emphasis>.
  639. The <emphasis>description</emphasis> begins after the starting delimiter <literal>
  640. /**</literal> and continues until the tag section. The tag section starts
  641. with the first character <literal>@</literal> that begins a line (ignoring
  642. leading asterisks, white space, and separator /**). It is possible to have
  643. a comment with only tags and no description. The description cannot continue
  644. after the tag section begins. The argument to a tag can span multiple lines.
  645.  There can be any number of tags — some types of tags can be repeated
  646. while others cannot. This <literal>@see</literal> starts the tag section:<informalexample>
  647. <para><screen> /**
  648.  * This is a doc comment.
  649.  * @see java.lang.Object
  650.  */</screen></para>
  651. </informalexample></para>
  652. <para><emphasis>Standalone and In-line Tags</emphasis></para>
  653. <para>A <emphasis>tag</emphasis> is a special keyword within a doc comment
  654. that the Javadoc tool can process. The Javadoc tool has standalone tags, which
  655. appear as <literal>@tag</literal>, and in-line tags, which appear within braces,
  656. as <literal>{@tag}</literal>. To be interpreted, a standalone tag must appear
  657. at the beginning of a line, ignoring leading asterisks, white space, and separator
  658. (/**). This means you can use the @ character elsewhere in the text and it
  659. will not be interpreted as the start of a tag. If you want to start a line
  660. with the @ character and not have it be interpreted, use the HTML entity <literal>
  661. &#064;</literal>. Each standalone tag has associated text, which includes
  662. any text following the tag up to, but not including, either the next tag,
  663. or the end of the doc comment. This associated text can span multiple lines.
  664.  An in-line tag is allowed and interpreted anywhere that text is allowed.
  665. The following example contains the standalone tag <literal>@deprecated</literal>
  666. and in-line tag <literal>{@link}</literal>.<informalexample>
  667. <screen>/**
  668.  * @deprecated  As of JDK 1.1, replaced \
  669.          by {@link #setBounds(int,int,int,int)}
  670.  */</screen>
  671. </informalexample></para>
  672. <para><emphasis>Comments are written in HTML</emphasis></para>
  673. <para>The text must be written in HTML so that comments can use HTML entities
  674. and HTML tags. You can use whichever version of HTML your browser supports;
  675. we have written the standard doclet to generate HTML 3.2-compliant code elsewhere
  676. (outside of the documentation comments) with the inclusion of cascading style
  677. sheets and frames. (We preface each generated file with "HTML 4.0" because
  678. of the frame sets.)</para>
  679. <para>For example, entities for the less-than (<) and greater-than (>)
  680. symbols should be written <literal>&lt;</literal> and <literal>&gt;
  681. </literal>. Likewise, the ampersand (&) should be written <literal>&amp;
  682. </literal>. The bold HTML tag <b> is shown in the following example:<informalexample>
  683. <para><screen>/**
  684. * This is a <b>doc</b> comment.
  685. * @see java.lang.Object
  686. */</screen></para>
  687. </informalexample></para>
  688. <para><emphasis>Leading Asterisks</emphasis></para>
  689. <para>When <command>javadoc</command> parses a doc comment, leading asterisk
  690. (*) characters on each line are discarded. Blanks and tabs preceding the initial
  691. asterisk (*) characters are also discarded. Starting with 1.4, if you omit
  692. the leading asterisk on a line, the leading white space is no longer removed.
  693. This enables you to paste code examples directly into a doc comment inside
  694. a <pre> tag, and its indentation will be honored. Spaces are generally
  695. interpreted by browsers more uniformly than tabs. Indentation is relative
  696. to the left margin (rather than the separator /** or tag). </para>
  697. <para><emphasis>First Sentence</emphasis></para>
  698. <para>The first sentence of each doc comment should be a summary sentence,
  699. containing a concise but complete description of the declared entity. This
  700. sentence ends at the first period that is followed by a blank, tab, or line
  701. terminator, or at the first standalone tag. The Javadoc tool copies this first
  702. sentence to the member summary at the top of the HTML page. See <option>breakiterator
  703. </option> for a description of how we are planning in a future release to
  704. change the way the sentence break is determined. </para>
  705. <para><emphasis>Declaration With Multiple Fields</emphasis></para>
  706. <para><command>Java</command> allows declaring multiple fields in a single
  707. statement, but this statement can have only one documentation comment, which
  708. is copied for all fields. Therefore, if you want individual documentation
  709. comments for each field, you must declare each field in a separate statement.
  710. For example, the following documentation comment does not make sense when
  711. written as a single declaration and would be better handled as two declarations:<informalexample>
  712. <para><screen>/**
  713. * The horizontal and vertical distances of point (x,y)
  714. */
  715. public int x, y;      // Avoid this</screen></para>
  716. </informalexample>The Javadoc tool generates the following documentation from
  717. the above code:<informalexample>
  718. <screen>public int x
  719.      The horizontal and vertical distances of point (x,y).
  720.  
  721. public int y
  722.      The horizontal and vertical distances of point (x,y).</screen>
  723. </informalexample></para>
  724. <para><emphasis>Use Header Tags Carefully</emphasis></para>
  725. <para>When writing documentation comments for members, it is best not to use
  726. HTML heading tags such as <literal><H1></literal> and <literal><H2>
  727. </literal>, because the Javadoc tool creates an entire structured document
  728. and these structural tags can interfere with the formatting of the generated
  729. document. However, it is fine to use these headings in class and package comments
  730. to provide your own structure.</para>
  731. <para><emphasis>Automatic Re-use of Method Comments</emphasis></para>
  732. <para>The Javadoc tool has the ability to automatically reuse or "inherit"
  733. method comments in classes an interfaces. When a description, or <literal>
  734. @return</literal>, <literal>@param</literal>,<literal> @see</literal> or <literal>
  735. @throws</literal> tag is missing from a method comment, the Javadoc tool instead
  736. copies the corresponding description or tag comment from the method it overrides
  737. or implements (if any), according to the algorithm below. </para>
  738. <para>More specifically, when a <literal>@param</literal> tag for a particular
  739. parameter is missing, then the comment for that parameter is copied. When
  740. an<literal> @throws</literal> tag for a particular exception is       missing,
  741. the <literal>@throws</literal> tag is copied only if that exception is declared. 
  742. </para>
  743. <para>This behavior contrasts with version 1.3 and earlier, where the presence
  744. of any description or tag would prevent all comments from being inherited. 
  745. </para>
  746. <para>Also of interest, if the inline tag {<literal>@inheritDoc</literal>}
  747. is present in a description or any tag, the corresponding description or tag
  748. is copied at that spot. </para>
  749. <para>The overridden method must be a member of a documented class, and not
  750. an external referenced class for the doc comment to actually be available
  751. to copy. </para>
  752. <para>Inheriting of comments occurs in three cases: </para>
  753. <itemizedlist>
  754. <listitem><para>When a method in a class overrides a method in a superclass.
  755. </para></listitem>
  756. <listitem><para>When a method in an interface overrides a method in a superinterface.
  757. </para></listitem>
  758. <listitem><para>When a method in a class implements a method in an interface.
  759. </para></listitem>
  760. </itemizedlist>
  761. <para>In the first two cases, for method overrides, the Javadoc tool generates
  762. a subheading "Overrides" in the documentation for the overriding method, with
  763. a link to the method it is overriding.</para>
  764. <para>In the third case,when a method in a given class implements a method
  765. in an interface, the Javadoc tool generates a subheading "Specified by" in
  766. the documentation for the overriding method, with a link to the method it
  767. is implementing.</para>
  768. <para><emphasis>Algorithm for Inheriting Method Descriptions</emphasis></para>
  769. <para> If a method does not have a doc comment, the Javadoc tool searches
  770. for an applicable comment using the following algorithm, which is designed
  771. to find the most specific applicable doc comment, giving preference to interfaces
  772. over superclasses: </para>
  773. <itemizedlist>
  774. <listitem><para>Look in each directly implemented (or extended) interface
  775. in the order they appear following the word implements (or extends) in the
  776. method declaration. Use the first doc comment found for this method. </para>
  777. </listitem>
  778. <listitem><para>If step 1 failed to find a doc comment, recursively apply
  779. this entire algorithm to each directly implemented (or extended) interface,
  780. in the same order they were examined in step 1. </para></listitem>
  781. <listitem><para>f step 2 failed to find a doc comment and this is a class
  782. other than <literal>Object</literal> (not an interface): </para>
  783. <itemizedlist>
  784. <listitem><para>If the superclass has a doc comment for this method, use it. 
  785. </para></listitem>
  786. <listitem><para>If step 3a failed to find a doc comment, recursively apply
  787. this entire algorithm to the                   superclass. </para></listitem>
  788. </itemizedlist>
  789. </listitem>
  790. </itemizedlist>
  791. </refsect2>
  792. <refsect2>
  793. <title>javadoc Tags</title>
  794. <para>The Javadoc tool parses special tags when they are embedded within a
  795. Java doc comment. These doc tags enable you to autogenerate a complete, well-formatted <acronym>
  796. API</acronym> from your source code. The tags start with an "at" sign (<literal>
  797. @</literal>) and are case-sensitive — they must be typed with the uppercase
  798. and lowercase letters as shown. A tag must start at the beginning of a line
  799. (after any leading spaces and an optional asterisk) or it is treated as normal
  800. text. By convention, tags with the same name are grouped together. For example,
  801. put all <literal>@see</literal> tags together.</para>
  802. <para>Tags come in two types: </para>
  803. <itemizedlist>
  804. <listitem><para><emphasis>Standalone tags</emphasis> - Can be placed only
  805. in the tag section that follows the description. These tags are not set off
  806. with curly braces: <literal>@tag</literal>. </para></listitem>
  807. <listitem><para><emphasis>Inline tags</emphasis> - Can be placed anywhere
  808. in the comment description or in the comments for standalone tags. Inline
  809. tags are set off with curly braces: {<literal>@tag</literal>}. </para></listitem>
  810. </itemizedlist>
  811. <para>For information about tags we might introduce in future releases, see
  812. Proposed Tags. </para>
  813. <para>The current tags are:</para>
  814. <informaltable frame="all" orient="port" remap="center">
  815. <tgroup cols="2" colsep="0" rowsep="0"><colspec colnum="1" colname="col1"
  816. colwidth="1*" colsep="1" align="left"><colspec colnum="2" colname="col2" colwidth="1*"
  817. align="left">
  818. <thead>
  819. <row><entry colname="col1" align="center" valign="top">Tag</entry><entry colname="col2"
  820. align="center" valign="top">Introduced </entry></row>
  821. <row rowsep="1"><entry colname="col1" valign="top"> </entry><entry colname="col2"
  822. align="center" valign="top">in JDK/SDK</entry></row>
  823. </thead>
  824. <tbody>
  825. <row><entry>@author</entry><entry>1.0</entry></row>
  826. <row><entry>{@docRoot}</entry><entry>1.3</entry></row>
  827. <row><entry>@deprecated</entry><entry>1.0</entry></row>
  828. <row><entry>@exception</entry><entry>1.0</entry></row>
  829. <row><entry colname="col1"><para>{<literal>@inheritDoc</literal>}</para></entry>
  830. <entry colname="col2"><para>1.4</para></entry></row>
  831. <row><entry>{@link}</entry><entry>1.2</entry></row>
  832. <row><entry colname="col1"><para>{<literal>@linkplain</literal>}</para></entry>
  833. <entry colname="col2"><para>1.4</para></entry></row>
  834. <row><entry>@param</entry><entry>1.0</entry></row>
  835. <row><entry>@return</entry><entry>1.0</entry></row>
  836. <row><entry>@see</entry><entry>1.0</entry></row>
  837. <row><entry>@serial</entry><entry>1.2</entry></row>
  838. <row><entry>@serialData</entry><entry>1.2</entry></row>
  839. <row><entry>@serialField</entry><entry>1.2</entry></row>
  840. <row><entry>@since</entry><entry>1.1</entry></row>
  841. <row><entry>@throws</entry><entry>1.2</entry></row>
  842. <row><entry colname="col1"><para>{<literal>@value</literal>}</para></entry>
  843. <entry colname="col2"><para>1.4</para></entry></row>
  844. <row><entry>@version</entry><entry>1.0</entry></row>
  845. </tbody>
  846. </tgroup>
  847. </informaltable>
  848. <para>For custom tags, see the <option>tag</option> option. </para>
  849. <variablelist termlength="wholeline">
  850. <varlistentry><term><literal>@author</literal> <replaceable>name-text</replaceable> 
  851. </term><listitem><para>Adds an "Author" entry with the specified <replaceable>
  852. name-text</replaceable> to the generated docs when the <option>author</option>
  853. option is used. A doc comment can contain multiple <literal>@author</literal>
  854. tags. You can specify one name per  <literal>@author</literal> tag or multiple
  855. names per tag. In the former case, the Javadoc tool inserts a comma (<literal>
  856. ,</literal>) and space between names. In the latter case, the entire text
  857. is copied to the generated document without being parsed. Therefore, use multiple
  858. names per line if you want a localized name separator other than a comma.
  859. </para>
  860. </listitem></varlistentry>
  861. <varlistentry><term><literal>@deprecated</literal> <replaceable>deprecated-text
  862. </replaceable></term><listitem><para>Adds a comment indicating that this API
  863. should no longer be used (even though it may continue to work). The Javadoc
  864. tool moves the<replaceable> deprecated-text</replaceable> ahead of the description,
  865. placing it in italics and preceding it with a bold warning: "Deprecated". 
  866. </para>
  867. <para>The first sentence of <replaceable>deprecated-text</replaceable> should
  868. at least tell the user when the API was deprecated and what to use as a replacement.
  869. The Javadoc tool copies just the first sentence to the summary section and
  870. index. Subsequent sentences can also explain why it has been deprecated. You
  871. should include a {<literal>@link</literal>} tag (for Javadoc 1.2 or later)
  872. that points to the replacement API: </para>
  873. <itemizedlist>
  874. <listitem><para>For Javadoc 1.2 and later, use a {<literal>@link</literal>}
  875. tag. This creates the link in-line, where you want it. For example: <screen>
  876. /**
  877.         * @deprecated  As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}
  878.         */</screen></para>
  879. </listitem>
  880. <listitem><para>For Javadoc 1.1, the standard format is to create a <literal>
  881. @see</literal> tag (which cannot be in-line) for each <literal>@deprecated
  882. </literal> tag. </para>
  883. </listitem>
  884. </itemizedlist>
  885. <para>For more about deprecation, see The <literal>@deprecated</literal> tag. 
  886. </para>
  887. </listitem></varlistentry>
  888. <varlistentry><term><literal>{@docRoot}</literal> </term><listitem><para>
  889. Represents the relative path to the generated document's (destination) root
  890. directory from any generated page. It is useful when you want to include a
  891. file, such as a copyright page or company logo, that you want to reference
  892. from all generated pages. Linking to the copyright page from the bottom of
  893. each page is common. </para>
  894. <para>This <literal>{@docRoot}</literal> tag can be used both on the command
  895. line and in a doc comment:</para>
  896. <orderedlist>
  897. <listitem><para>On the command line, where the header/footer/bottom are defined: <informalexample>
  898. <screen><userinput>javadoc -bottom '<a href="{@docRoot}/\
  899.         copyright.html">Copyright</a>'</userinput></screen>
  900. </informalexample></para>
  901. <para>NOTE - When using {<literal>@docRoot</literal>} this way in a make file,
  902. some makefile programs require special escaping for the brace<literal> {}
  903. </literal> characters. For example, the Inprise MAKE version 5.2 running on
  904. Windows requires double braces: {{<literal>@docRoot</literal>}}. It also requires
  905. double (rather than single) quotes to enclose arguments to options such as <option>
  906. bottom</option> (with the quotes            around the href argument omitted). 
  907. </para>
  908. </listitem>
  909. <listitem><para>In a doc comment: <informalexample>
  910. <screen><literal>/**
  911. * See the <a href="{@docRoot}/\
  912.        copyright.html">Copyright</a>.
  913. */</literal></screen>
  914. </informalexample></para>
  915. </listitem>
  916. </orderedlist>
  917. <para>The reason this tag is needed is because the generated docs are in hierarchical
  918. directories, as deep as the number of subpackages. This expression:<informalexample>
  919. <screen><a href="{@docRoot}/copyright.html"></screen>
  920. </informalexample> would resolve to:<informalexample>
  921. <screen><a href="../../copyright.html">   </screen>
  922. </informalexample>for <literal>java/lang/Object.java</literal>, and it would
  923. resolve to<informalexample>
  924. <screen><a href="../../../copyright.html"></screen>
  925. </informalexample> for <literal>java/lang/ref/Reference.java</literal></para>
  926. </listitem></varlistentry>
  927. </variablelist>
  928. <variablelist termlength="wholeline">
  929. <varlistentry><term><literal>@exception</literal> <replaceable>class-name
  930. description</replaceable> </term><listitem><para>The <literal>@exception</literal>
  931. tag is a synonym for <literal>@throws</literal>. </para>
  932. </listitem></varlistentry>
  933. <varlistentry><term>{<literal>@inheritDoc</literal>}</term><listitem><para>
  934. Inherits documentation from the nearest superclass into the current doc comment.
  935. This allows comments to be abstracted up the inheritance tree, and enables
  936. developers to write around the copied text. Also see            inheriting
  937. comments. </para>
  938. <para>This tag can be placed in two positions: </para>
  939. <itemizedlist>
  940. <listitem><para>n the comment body (before the first standalone tag), where
  941. it will copy the entire              comment body from its superclass. </para>
  942. </listitem>
  943. <listitem><para>In the text argument of a standalone tag, where it will copy
  944. the text of the tag from its                  superclass. </para>
  945. </listitem>
  946. </itemizedlist>
  947. </listitem></varlistentry>
  948. <varlistentry><term>{<literal>@link</literal> <replaceable>package.class#member
  949. label</replaceable>}</term><listitem><para>Inserts an in-line link with visible
  950. text label that points to the documentation for the specified            package,
  951. class or member name of a referenced class. </para>
  952. <para>This tag is very simliar to<literal> @see</literal> -- both require
  953. the same references and accept exactly the same syntax for <replaceable>package.class#member
  954. </replaceable> and <replaceable>label</replaceable>. The main difference is
  955. that {<literal>@link</literal>} generates an in-line link rather than placing
  956. the link in the "See Also" section. Also, the {<literal>@link</literal>} tag
  957. begins and ends with curly braces to separate it from the rest of the in-line
  958. text. If you need to use "}" inside the label, use the HTML entity notation <literal>
  959. &#125;</literal>. </para>
  960. <para>There is no limit to the number of <literal>{@link}</literal> tags allowed
  961. in a sentence. You can use this tag in the description part of a documentation
  962. comment or in the text portion of any tag (such as <literal>@deprecated</literal>, <literal>
  963. @return</literal>, or  <literal>@param</literal>).</para>
  964. <para>For example, here is a comment that refers to the <literal>getComponentAt(int,
  965. int)</literal> method:<informalexample>
  966. <screen>Use the {@link #getComponentAt(int, int) getComponentAt} method.</screen>
  967. </informalexample></para>
  968. <para>From this, the standard doclet would generate the following HTML (assuming
  969. it refers to another class in the same package):<informalexample>
  970. <screen>Use the 
  971. <a href="Component.html#getComponentAt(int, int)">\
  972.                getComponentAt</a>method.</screen>
  973. </informalexample></para>
  974. <para>which appears on the web page as:<informalexample>
  975. <screen>Use the getComponentAt method.</screen>
  976. </informalexample></para>
  977. <para>You can extend <literal>{@link}</literal> to link to classes not being
  978. documented by using the <option>link</option> option. </para>
  979. </listitem></varlistentry>
  980. <varlistentry><term><literal>{@linkplain</literal> <replaceable>package.class#member
  981.  label</replaceable></term><listitem><para>Identical to<literal> {@link}</literal>,
  982. except the link's label is displayed in plain text than code font. Useful
  983. when the label is plain text. Example: </para>
  984. <informalexample>
  985. <screen> Refer to {@linkplain add() the overridden method}.</screen>
  986. </informalexample>
  987. <para>This would display as: </para>
  988. <informalexample>
  989. <screen>Refer to the overridden method. </screen>
  990. </informalexample>
  991. </listitem></varlistentry>
  992. <varlistentry><term><literal>@param</literal> <replaceable>parameter-name
  993. description</replaceable> </term><listitem><para>Adds a parameter to the "Parameters"
  994. section. The description may be continued on the next line.</para>
  995. </listitem></varlistentry>
  996. <varlistentry><term><literal>@return</literal> <replaceable>description</replaceable> 
  997. </term><listitem><para>Adds a "Returns" section with the description text.
  998. This text should describe the return type and permissible range of values.
  999. </para>
  1000. </listitem></varlistentry>
  1001. <varlistentry><term><literal>@see</literal> <replaceable>reference</replaceable> 
  1002. </term><listitem><para>Adds a "See Also" heading with a link or text entry
  1003. that points to <replaceable>reference</replaceable>. A doc comment can contain
  1004. any number of <literal>@see</literal> tags, which are all grouped under the
  1005. same heading. The <literal>@see</literal> tag has three variations; the third
  1006. form below is the most common. For inserting an in-line link within a sentence
  1007. to a package, class or member, see<literal> {@link}</literal>. </para>
  1008. </listitem></varlistentry>
  1009. <varlistentry><term><literal>@see</literal> <replaceable>string</replaceable> 
  1010. </term><listitem><para>Adds a text entry for <replaceable>string</replaceable>.
  1011. No link is generated. The <replaceable>string</replaceable> is a book or other
  1012. reference to information not available by URL. The Javadoc tool distinguishes
  1013. this from the previous cases by looking for a double-quote (") as the first
  1014. character. For example:<informalexample>
  1015. <screen>@see "The Java Programming Language"</screen>
  1016. </informalexample></para>
  1017. <para>This generates text such as:<informalexample>
  1018. <screen>See Also:
  1019.           "The Java Programming Language"</screen>
  1020. </informalexample></para>
  1021. </listitem></varlistentry>
  1022. <varlistentry><term><literal>@see <a href="</literal><replaceable>URL#value
  1023. </replaceable><literal>"></literal><replaceable>label</replaceable><literal>
  1024. </a></literal></term><listitem><para>Adds a link as defined by <replaceable>
  1025. URL#value</replaceable>. The <replaceable>URL#value</replaceable> is a relative
  1026. or absolute URL. The Javadoc tool distinguishes this from other cases by looking
  1027. for a less-than symbol (<literal><</literal>) as the first character. For
  1028. example:<informalexample>
  1029. <screen>@see <a href="spec.html#section">Java Spec</a></screen>
  1030. </informalexample>This generates a link such as:<informalexample>
  1031. <screen>See Also:
  1032.        Java Spec</screen>
  1033. </informalexample></para>
  1034. </listitem></varlistentry>
  1035. <varlistentry><term><literal>@see</literal> <replaceable>package.class#member
  1036. label</replaceable> </term><listitem><para>Adds a link, with visible text<replaceable>
  1037.  label</replaceable>, that points to the documentation for the specified name
  1038. in the Java Language. The<replaceable> label</replaceable> is optional; if
  1039. omitted, the name appears instead as the visible text, suitably shortened —
  1040. see <literal>How a Name Is Displayed</literal>. Use the label when you want
  1041. the visible text to be abbreviated or different from the name.</para>
  1042. </listitem></varlistentry>
  1043. </variablelist><para>In only version 1.2, just the name but not the label
  1044. would automatically appear in <literal><code></literal> HTML tags. Starting
  1045. with 1.2.2, the <literal><code></literal> is always included around the
  1046. visible text, whether or not a label is used.</para>
  1047. <itemizedlist>
  1048. <listitem><para><replaceable>package.class#member</replaceable> is any valid
  1049. name in the Java Language that is referenced — a package, class, interface,
  1050. constructor, method, or field name — except that you replace the dot
  1051. ahead of the member name with a hash character (#). If this name is in the
  1052. documented classes, the Javadoc tool will automatically create a link to it.
  1053. To create links to external referenced classes, use the <option>link</option>
  1054. option. Use either of the other two <literal>@see</literal> forms for referring
  1055. to documentation of a name that does not belong to a referenced class. This
  1056. argument is described at greater length below under <literal>Specifying a
  1057. Name</literal>.</para></listitem>
  1058. <listitem><para><replaceable>label</replaceable> is optional text that is
  1059. visible as the link's label. The<replaceable> label</replaceable> can contain
  1060. white space. If a<replaceable> label</replaceable> is omitted, then <replaceable>
  1061. package.class.member</replaceable> will appear, suitably shortened relative
  1062. to the current class and package — see <literal>How a Name Is Displayed
  1063. </literal>.</para></listitem>
  1064. <listitem><para>A space is the delimiter between <replaceable>package.class#member
  1065. </replaceable> and <replaceable>label</replaceable>. A space inside parentheses
  1066. does not indicate the start of a label, so spaces can be used between parameters
  1067. in a method.</para></listitem>
  1068. </itemizedlist>
  1069. <para>In this example, an <literal>@see</literal> tag (in the Character class)
  1070. refers to the equals method in the String class. The tag includes both arguments,
  1071. that is, the name "<literal>String#equals(Object)</literal>" and the label
  1072. "<literal>equals</literal>":<informalexample>
  1073. <screen>      /**
  1074.       * @see String#equals(Object) equals
  1075.       */</screen>
  1076. </informalexample></para>
  1077. <para>The standard doclet produces HTML something like this:<informalexample>
  1078. <screen>    <dl>
  1079.     <dt><b>See Also:</b>
  1080.     <dd><a href="../../java/lang/String#equals\
  1081.                  (java.lang.Object)"><code>equals</code></a>
  1082.     </dl></screen>
  1083. </informalexample></para>
  1084. <para>The above looks something like this in a browser, where the label is
  1085. the visible link text:<informalexample>
  1086. <screen>See Also:
  1087.      equals</screen>
  1088. </informalexample></para>
  1089. <para><emphasis>Specifying a Name:</emphasis> This <replaceable>package.class#member
  1090. </replaceable> name can be either fully qualified, such as <literal>java.lang.String#toUpperCase()
  1091. </literal>, or not, such as <literal>String#toUpperCase()</literal> or <literal>
  1092. #toUpperCase()</literal>. If less than fully-qualified, <command>javadoc</command>
  1093. uses the normal Java compiler search order to find it, further described below
  1094. in <literal>Search Order for @see</literal>. The name can contain whitespace
  1095. within parentheses, such as between method arguments.</para>
  1096. <para>The advantage to providing shorter, "partially-qualified" names is that
  1097. they require are less to type and less clutter in the source code. The following
  1098. table shows the different forms of the name, where Class can be a class or
  1099. interface, Type can be a class, interface, array, or primitive, and method
  1100. can be a method or constructor.</para>
  1101. <informaltable frame="all" orient="port">
  1102. <tgroup cols="1" colsep="0" rowsep="0"><colspec colnum="1" colname="col1"
  1103. colwidth="1*" align="left">
  1104. <thead>
  1105. <row valign="top"><entry colname="col1" rowsep="1" align="left">Typical forms
  1106. for @see <replaceable>package.class#member</replaceable></entry></row>
  1107. </thead>
  1108. <tbody>
  1109. <row><entry><para> </para></entry></row>
  1110. <row><entry>Referencing a member of the current class</entry></row>
  1111. <row><entry><literal>@see</literal> <replaceable>#field</replaceable></entry>
  1112. </row>
  1113. <row><entry><literal>@see</literal> <replaceable>#method(Type, Type,...)</replaceable></entry>
  1114. </row>
  1115. <row><entry>@see <replaceable>#method(Type argname, Type argname,...)</replaceable></entry>
  1116. </row>
  1117. <row><entry><para> </para></entry></row>
  1118. <row><entry>Referencing another class in the current or imported packages
  1119. </entry></row>
  1120. <row><entry><literal>@see</literal> <replaceable>Class#field</replaceable></entry>
  1121. </row>
  1122. <row><entry><literal>@see</literal> <replaceable>Class#method(Type, Type,...)
  1123. </replaceable></entry></row>
  1124. <row><entry><literal>@see</literal> <replaceable>Class#method(Type argname, Type argname,...)
  1125. </replaceable></entry></row>
  1126. <row><entry><literal>@see</literal> <replaceable>Class</replaceable></entry>
  1127. </row>
  1128. <row><entry><para> </para></entry></row>
  1129. <row><entry>Referencing another package (fully qualified)</entry></row>
  1130. <row><entry><literal>@see</literal> <replaceable>package.Class#field</replaceable></entry>
  1131. </row>
  1132. <row><entry><literal>@see</literal> <replaceable>package.Class#method(Type, Type,...)
  1133. </replaceable></entry></row>
  1134. <row><entry><literal>@see</literal> <replaceable>package.Class#method(Type argname, Type argname,...)
  1135. </replaceable></entry></row>
  1136. <row><entry><literal>@see</literal> <replaceable>package.Class</replaceable></entry>
  1137. </row>
  1138. <row><entry><literal>@see</literal> <replaceable>package</replaceable></entry>
  1139. </row>
  1140. </tbody>
  1141. </tgroup>
  1142. </informaltable>
  1143. <para>The following notes apply to the above table:</para>
  1144. <itemizedlist>
  1145. <listitem><para>The first set of forms (with no class or package) will cause
  1146. the Javadoc tool to search only through the current class's hierarchy. It
  1147. will find a member of the current class or interface, one of its superclasses
  1148. or superinterfaces, or one of its enclosing classes or interfaces (search
  1149. steps 1-3). It will not search the rest of the current package or other packages
  1150. (search steps 4-5).</para></listitem>
  1151. <listitem><para>If any method or constructor is entered as a name with no
  1152. parentheses, such as <literal>getValue</literal>, and if no field with the
  1153. same name exists, the Javadoc tool will correctly create a link to it, but
  1154. will print a warning message reminding you to add the parentheses and arguments.
  1155. If this method is overloaded, the Javadoc tool will link to the first method
  1156. that its search encounters, which is unspecified.</para></listitem>
  1157. <listitem><para>Nested classes must be specified as <literal>outer.inner</literal>,
  1158. not simply <literal>inner</literal>, for all forms.</para></listitem>
  1159. <listitem><para>As stated, the hash character (<literal>#</literal>), rather
  1160. than a dot (<literal>.</literal>), separates a member from its class. This
  1161. enables the Javadoc tool to resolve ambiguities, since the dot also separates
  1162. classes, inner classes, packages, and subpackages. However, the Javadoc tool
  1163. is generally lenient and will properly parse a dot if you know there is no
  1164. ambiguity, though it will print a warning.</para></listitem>
  1165. </itemizedlist>
  1166. <para><emphasis>Search Order for @see:</emphasis> the Javadoc tool will process
  1167. an <literal>@see</literal> tag that appears in a source file (<literal>.java
  1168. </literal>), package file (<literal>package.html</literal>), or overview file
  1169. (<literal>overview.html</literal>). In the latter two files, you must fully
  1170. qualify the name you supply with <literal>@see</literal>. In a source file,
  1171. you can specify a name that is fully qualified or partially qualified.</para>
  1172. <para>When the Javadoc tool encounters an  <literal>@see</literal> tag in
  1173. a <literal>.java</literal> file that is not fully qualified, it searches for
  1174. the specified name in the same order as the Java compiler would (except the
  1175. Javadoc tool will not detect certain namespace ambiguities, since it assumes
  1176. the source code is free of these errors). This search order is formally defined
  1177. in Chapter 6, "Names" of the <citetitle>Java Language Specification</citetitle>,
  1178. Second Edition. The Javadoc tool searches for that name through all related
  1179. and imported classes and packages. In particular, it searches in this order:
  1180. </para>
  1181. <orderedlist>
  1182. <listitem><para>The current class or interface</para></listitem>
  1183. <listitem><para>Any enclosing classes and interfaces, searching closest first
  1184. </para></listitem>
  1185. <listitem><para>Any superclasses and superinterfaces, searching closest first
  1186. </para></listitem>
  1187. <listitem><para>The current package</para></listitem>
  1188. <listitem><para>Any imported packages, classes and interfaces, searching in
  1189. the order of the import statement</para></listitem>
  1190. </orderedlist>
  1191. <para>The Javadoc tool continues to search recursively through steps 1-3 for
  1192. each class it encounters until it finds a match. That is, after it searches
  1193. through the current class and its enclosing class E, it searches through E's
  1194. superclasses before E's enclosing classes. In steps 4 and 5, the Javadoc tool
  1195. does not search classes or interfaces within a package in any specified order
  1196. (that order depends on the particular compiler). In step 5, the Javadoc tool
  1197. will look in <literal>java.lang</literal>, since that is automatically imported
  1198. by all programs.</para>
  1199. <para>The Javadoc tool will not necessarily look in subclasses, nor will it
  1200. look in other packages even if their documentation is being generated in the
  1201. same run. For example, if the <literal>@see</literal> tag is in the <literal>
  1202. java.awt.event.KeyEvent</literal> class and refers to a name in the <literal>
  1203. java.awt</literal> package, <command>javadoc</command> will not look in that
  1204. package unless that class imports it.</para>
  1205. <para><emphasis>How a Name is Displayed</emphasis>: If <replaceable>label
  1206. </replaceable> is omitted, then <replaceable>package.class.member</replaceable>
  1207. will appear. In general, it will be suitably shortened relative to the current
  1208. class and package. By "shortened", we mean the Javadoc tool will display only
  1209. the minimum name necessary. For example, if the <literal>String.toUpperCase()
  1210. </literal> method contains references to a member of the same class and to
  1211. a member of a different class, the class name will be displayed only in the
  1212. latter case:</para>
  1213. <para><screen><replaceable>Type of Ref-</replaceable>         <replaceable>
  1214. Example</replaceable>                           <replaceable>Displays As</replaceable>
  1215.    <replaceable>erence</replaceable>
  1216.  
  1217. @see tag refers to   @see String#toLowerCase()         toLowerCase()
  1218. member of the                                          (omits the class
  1219. same class                                              name)
  1220.  
  1221. @see tag refers to   @see Character#toLowerCase(char)  Character.to\
  1222. member of a                                             LowerCase(char)
  1223. different class                                        (includes the class
  1224.                                                         name)</screen></para>
  1225. <para><emphasis>Examples of @see:</emphasis> The comment to the right shows
  1226. how the name would be displayed if the <literal>@see</literal> tag is in a
  1227. class in another package, such as <literal>java.applet.Applet</literal>:</para>
  1228. <informaltable orient="port">
  1229. <tgroup cols="2" colsep="0" rowsep="0"><colspec colnum="1" colname="col1"
  1230. colwidth="1*" align="left"><colspec colnum="2" colname="col2" colwidth="1*"
  1231. align="left">
  1232. <tbody>
  1233. <row><entry><replaceable>Example</replaceable></entry><entry><replaceable>
  1234. See also:</replaceable></entry></row>
  1235. <row><entry></entry><entry></entry></row>
  1236. <row><entry><literal>@see java.lang.String</literal></entry><entry>// String
  1237. </entry></row>
  1238. <row><entry><literal>@see java.lang.String The String class</literal></entry>
  1239. <entry>// The String class</entry></row>
  1240. <row><entry><literal>@see String</literal></entry><entry>// String</entry>
  1241. </row>
  1242. <row><entry><literal>@see String#equals(Object)</literal></entry><entry>// String.equals(Object)
  1243. </entry></row>
  1244. <row><entry><literal>@see String#equals</literal></entry><entry>// String.equals\
  1245.       (java.lang.Object)</entry></row>
  1246. <row><entry><literal>@see java.lang.Object#wait(long)</literal></entry><entry>
  1247. // java.lang.Object.\
  1248.       wait(long)</entry></row>
  1249. <row><entry><literal>@see Character#MAX_RADIX</literal></entry><entry>// Character.MAX_RADIX
  1250. </entry></row>
  1251. <row><entry><literal>@see <a href="spec.html">Java Spec</a></literal></entry>
  1252. <entry>// Java Spec</entry></row>
  1253. <row><entry><literal>@see "The Java Programming Language"</literal></entry>
  1254. <entry>// "The Java Programming \
  1255.       Language"</entry></row>
  1256. </tbody>
  1257. </tgroup>
  1258. </informaltable>
  1259. <para>You can extend <literal>@see</literal> to link to classes not being
  1260. documented by using the <option>link</option> option. Notice that this works
  1261. only for classes that are referenced in a particular way as described at <literal>
  1262. How an Excluded Class Must Be Referenced for a Link to Appear</literal>.</para>
  1263. <variablelist termlength="wholeline">
  1264. <varlistentry><term><literal>@since</literal> <replaceable>since-text</replaceable> 
  1265. </term><listitem><para>Adds a "Since" heading with the specified <replaceable>
  1266. since-text</replaceable> to the generated documentation. The text has no special
  1267. internal structure. This tag means that this change or feature has existed
  1268. since the software release specified by the <replaceable>since-text</replaceable>.
  1269. For example: <informalexample><para><screen>@since 1.4</screen></para>
  1270. </informalexample></para>
  1271. <para>For source code in the Java platform, this tag indicates the version
  1272. of the Java platform <acronym>API</acronym> specification (not necessarily
  1273. when it was added to             the reference implementation). </para>
  1274. </listitem></varlistentry>
  1275. <varlistentry><term><literal>@serial</literal> <replaceable>field-description
  1276. </replaceable> | <literal>include</literal> | <literal>exclude</literal></term>
  1277. <listitem><para>Used in the doc comment for a default serializable field.
  1278. </para>
  1279. <para>An optional <replaceable>field-description</replaceable> should explain
  1280. the meaning of the field and list the acceptable values. If needed, the description
  1281. can span multiple lines. The standard doclet adds this information to the <literal>
  1282. serialized form page</literal>.</para>
  1283. <para>If a serializable field was added to a class some time after the class
  1284. was made serializable, a statement should be added to its description to identify
  1285. at which version it was added. </para>
  1286. <para>The <literal>include</literal> and <literal>exclude</literal> arguments
  1287. identify whether a class or package should be included or excluded from the
  1288. serialized form page. They work as follows:<itemizedlist>
  1289. <listitem><para>A public or protected class that implements <literal>Serializable
  1290. </literal> is included unless that class (or its package) is marked <literal>
  1291. @serial exclude</literal>.</para>
  1292. </listitem>
  1293. <listitem><para>A private or package-private class that implements <literal>
  1294. Serializable</literal> is excluded unless that class (or its package) is marked <literal>
  1295. @serial include</literal>.</para>
  1296. </listitem>
  1297. </itemizedlist></para>
  1298. <para><emphasis>Examples:</emphasis> The <literal>javax.swing</literal> package
  1299. is marked <literal>@serial exclude</literal> (in <literal>package.html</literal>).
  1300. The public class <literal>java.security.BasicPermission</literal> is marked <literal>
  1301. @serial exclude</literal>. The package-private class <literal>java.util.PropertyPermissionCollection
  1302. </literal> is marked <literal>@serial include</literal>.</para>
  1303. <para>The tag <literal>@serial</literal> at a class level overrides <literal>
  1304. @serial</literal> at a package level.</para>
  1305. <para>The <literal>@since</literal> tag should be added to each serializable
  1306. field that has been added since the initial version of a <literal>Serializable
  1307. </literal> class to identify when it was added.</para>
  1308. <para>For more information about how to use these tags, along with an example,
  1309. see "Documenting Serializable Fields and Data for a Class," Section 1.6 of
  1310. the <citetitle>Java Object Serialization Specification</citetitle>. Also see
  1311. the <citetitle>Serialization FAQ</citetitle>, which covers the questions,
  1312. such as "Why do I see <command>javadoc</command> warnings stating that I am
  1313. missing <literal>@serial</literal> tags for private fields if I am not running <command>
  1314. javadoc</command> with the <option>private</option> switch?".</para>
  1315. </listitem></varlistentry>
  1316. <varlistentry><term><literal>@serialField</literal> <replaceable>field-name
  1317.  field-type  field-description</replaceable> </term><listitem><para>Documents
  1318. an <literal>ObjectStreamField</literal> component of a <literal>Serializable
  1319. </literal> class's <literal>serialPersistentFields</literal> member. One <literal>
  1320. @serialField</literal> tag should be used for each <literal>ObjectStreamField
  1321. </literal> component.</para>
  1322. </listitem></varlistentry>
  1323. <varlistentry><term><literal>@serialData</literal> <replaceable>data-description
  1324. </replaceable> </term><listitem><para>A <replaceable>data-description</replaceable>
  1325. documents the types and order of datain the serialized form. Specifically,
  1326. this data includes the optional data written by the <literal>writeObject</literal>
  1327. method and all data (including base classes) written by the <literal>Externalizable.writeExternal
  1328. </literal> method.</para>
  1329. <para>The <literal>@serialData</literal> tag can be used in the doc comment
  1330. for the <literal>writeObject</literal>, <literal>readObject</literal>, <literal>
  1331. writeExternal</literal>, and <literal>readExternal</literal> methods.</para>
  1332. </listitem></varlistentry>
  1333. </variablelist>
  1334. <variablelist termlength="wholeline">
  1335. <varlistentry><term><literal>@throws</literal> <replaceable>class-name  description
  1336. </replaceable> </term><listitem><para>The <literal>@throws</literal> and <literal>
  1337. @exception</literal> tags are synonyms. Adds a "Throws" subheading to the
  1338. generated documentation, with the <replaceable>class-name</replaceable> and <replaceable>
  1339. description</replaceable> text. The <replaceable>class-name</replaceable>
  1340. is the name of the exception that can be thrown by the method. If this class
  1341. is not fully specified, the Javadoc tool uses the search order to look up
  1342. this class. A <literal>@throws </literal>tag's comment documented in a superclass
  1343. or interface is inherited             in two cases: (1) for a corresponding
  1344. exception declared in a throws clause of the subclass and (2) for all runtime
  1345. exceptions. If neither is the case and you want to force the documentation
  1346. to be inherited, then use <literal>{@inheritDoc}</literal>. </para>
  1347. </listitem></varlistentry>
  1348. <varlistentry><term><literal>{@value} </literal></term><listitem><para>When
  1349. used in a static field comment, displays the value of the constant. These
  1350. are the values displayed on the <literal>Constant Field Values page</literal>. 
  1351. </para>
  1352. </listitem></varlistentry>
  1353. <varlistentry><term><literal>@version</literal> <replaceable>version-text
  1354. </replaceable> </term><listitem><para>Adds a "Version" subheading with the
  1355. specified <replaceable>version-text</replaceable> to the generated docs when
  1356. the <option>version</option> option is used. The text has no special internal
  1357. structure. A doc comment can contain at most one <literal>@version</literal>
  1358. tag. Version normally refers to the version of the software (such as the Java
  1359. 2 SDK) that contains this class or member.</para>
  1360. </listitem></varlistentry>
  1361. </variablelist></refsect2>
  1362. <refsect2>
  1363. <title>Where Tags Can Be Used</title>
  1364. <para>The following sections describe where the tags can be used. Notice that
  1365. these four tags can be used in all doc comments: <literal>@see</literal>, <literal>
  1366. @link</literal>, <literal>@since</literal>, <literal>@deprecated</literal>. 
  1367. </para>
  1368. </refsect2>
  1369. <refsect2>
  1370. <title>Overview Documentation Tags</title>
  1371. <para>Overview tags are tags that can appear in the documentation comment
  1372. for the overview page (which resides in the source file typically named <literal>
  1373. overview.html</literal>). Like in any other documentation comments, these
  1374. tags must appear after the description.</para>
  1375. <para><emphasis>Note:</emphasis> The <literal>{@link}</literal> tag has a
  1376. bug in overview documents in version 1.2 — the text appears properly
  1377. but has no link. The<literal> {@docRoot}</literal> tag does not currently
  1378. work in overview documents. <informalexample>
  1379. <screen><emphasis>Overview Tags</emphasis>
  1380.  
  1381. @see
  1382. @since
  1383. @author
  1384. @version
  1385. {@link}
  1386. {@linkplain}
  1387. {@docRoot}</screen>
  1388. </informalexample></para>
  1389. </refsect2>
  1390. <refsect2>
  1391. <title>Package Documentation Tags</title>
  1392. <para>Package tags are tags that can appear in the documentation comment for
  1393. a package (which resides in the source file named <literal>package.html</literal>).
  1394. The <literal>@serial</literal> tag can only be used here with the <literal>
  1395. include</literal> or <literal>exclude</literal> argument.<informalexample>
  1396. <screen><emphasis>Package Tags</emphasis>
  1397.  
  1398. @see
  1399. @since
  1400. @deprecated
  1401. @serial
  1402. @author
  1403. @version
  1404. {@link}
  1405. {@linkplain}
  1406. {@docRoot}</screen>
  1407. </informalexample></para>
  1408. </refsect2>
  1409. <refsect2>
  1410. <title>Class and Interface Documentation Tags</title>
  1411. <para>The following are tags that can appear in the documentation comment
  1412. for a class or interface. The <literal>@serial</literal> tag can only be used
  1413. here with the <literal>include</literal> or <literal>exclude</literal> argument. <informalexample>
  1414. <screen><emphasis>Class/Interface Tags</emphasis>
  1415.  
  1416. @see
  1417. @since
  1418. @deprecated
  1419. @serial
  1420. @author
  1421. @version
  1422. {@link}
  1423. {@linkplain}
  1424. {@docRoot}</screen>
  1425. </informalexample></para>
  1426. <para>An example of a class comment:<informalexample><para><screen>/**
  1427. * A class representing a window on the screen.
  1428. * For example:
  1429. * <pre>
  1430. *    Window win = new Window(parent);
  1431. *    win.show();
  1432. * </pre>
  1433. *
  1434. * @author  Sami Shaio
  1435. * @version 1.5, 11/29/01
  1436. * @see     java.awt.BaseWindow
  1437. * @see     java.awt.Button
  1438. */
  1439. class Window extends BaseWindow {
  1440. }</screen></para>
  1441. </informalexample></para>
  1442. </refsect2>
  1443. <refsect2>
  1444. <title>Field Documentation Tags</title>
  1445. <para>The following are the tags that can appear in the documentation comment
  1446. for a field.<informalexample>
  1447. <screen><emphasis>Field Tags</emphasis>
  1448.  
  1449. @see
  1450. @since
  1451. @deprecated
  1452. @serial
  1453. @serialField
  1454. {@link}
  1455. {@linkplain}
  1456. {@docRoot}
  1457. {@value}</screen>
  1458. </informalexample></para>
  1459. <para>An example of a field comment:<informalexample><para><screen>/**
  1460. * The X-coordinate of the component.
  1461. *
  1462. * @see #getLocation()
  1463. */
  1464. int x = 1263732;</screen></para>
  1465. </informalexample></para>
  1466. </refsect2>
  1467. <refsect2>
  1468. <title>Constructor and Method Documentation Tags</title>
  1469. <para>The following are the tags that can appear in the documentation comment
  1470. for a constructor or method, except for <literal>{@inheritDoc}</literal>,
  1471. which cannot appear in a constructor..<informalexample>
  1472. <screen><emphasis>Method/Constructor Tags</emphasis>
  1473.  
  1474. @see
  1475. @since
  1476. @deprecated
  1477. @param
  1478. @return
  1479. @throws (@exception)
  1480. @serialData
  1481. {@link}
  1482. {@linkplain}
  1483. {@inheritDoc}
  1484. {@docRoot}</screen>
  1485. </informalexample></para>
  1486. <para>An example of a method doc comment:<informalexample><para><screen>/**
  1487. * Returns the character at the specified index. An index
  1488. * ranges from <code>0</code> to <code>length() - 1</code>.
  1489. *
  1490. * @param     index  the index of the desired character.
  1491. * @return    the desired character.
  1492. * @exception StringIndexOutOfRangeException
  1493. *              if the index is not in the range <code>0</code>
  1494. *              to <code>length()-1</code>.
  1495. * @see       java.lang.Character#charValue()
  1496. */
  1497. public char charAt(int index) {
  1498. }</screen></para>
  1499. </informalexample></para>
  1500. </refsect2>
  1501. </refsect1>
  1502. <refsect1><title>&opts-tt;</title>
  1503. <para>The <command>javadoc</command> tool uses doclets to determine its output.
  1504. The Javadoc tool uses the default standard doclet unless a custom doclet is
  1505. specified with the <option>doclet</option> option. The Javadoc tool provides
  1506. a set of command-line options that can be used with any doclet. These options
  1507. are described below under the sub-heading <literal>javadoc Options</literal>.
  1508. The standard doclet provides an additional set of command-line options that
  1509. are described below, under the sub-heading <literal>Options Provided by the
  1510. Standard Doclet</literal>. All option names are case-insensitive, though their
  1511. arguments can be case-sensitive.</para>
  1512. <para>The options are:</para>
  1513. <para><screen>        -1.1                   -header            -private
  1514.         -author                -help              -protected
  1515.         -bootclasspath         -helpfile          -public
  1516.         -bottom                -J                 -quiet
  1517.             -breakiterator         -link              -serialwarn 
  1518.         -charset               -linkoffline       -source
  1519.         -classpath             -linksource        -sourcepath
  1520.         -d                     -locale            -splitindex
  1521.         -docencoding           -nocomment         -stylesheetfile
  1522.         -docfilessubedir       -nodeprecated      -subpackages
  1523.             -doclet                -nodeprecatedlist  -tag
  1524.         -docletpath            -nohelp            -taglet
  1525.         -doctitle              -noindex           -tagletpath
  1526.         -encoding              -nonavbar          -title
  1527.         -exclude                    -noqualifier       -use
  1528.             -excludedocfilessubdir -nosince           -verbose
  1529.             -extdirs               -notree            -version
  1530.         -footer                -overview          -windowtitle
  1531.         -group                 -package                                                                                     
  1532. </screen></para>
  1533. <refsect2>
  1534. <title>javadoc Options</title>
  1535. <variablelist termlength="wholeline">
  1536. <varlistentry><term><option>overview</option> <replaceable>path/filename</replaceable> 
  1537. </term><listitem><para>Specifies that <command>javadoc</command> should retrieve
  1538. the text for the overview documentation from the "source" file specified by <replaceable>
  1539. path/filename</replaceable> and place it on the Overview page (<literal>overview-summary.html
  1540. </literal>). The <replaceable>path/filename</replaceable> is relative to the <option>
  1541. sourcepath</option>.</para>
  1542. <para>While you can use any name you want for <replaceable>filename</replaceable>
  1543. and place it anywhere you want for <replaceable>path</replaceable>, a typical
  1544. thing to do is to name it <literal>overview.html</literal> and place it in
  1545. the source tree at the directory that contains the topmost package directories.
  1546. In this location, no path is needed when documenting packages, since <option>
  1547. sourcepath</option> will point to this file. For example, if the source tree
  1548. for the <literal>java.lang</literal> package is <literal>/src/classes/java/lang/
  1549. </literal>, then you could place the overview file at  <literal>/src/classes/overview.html
  1550. </literal>. See <literal>Real World Example</literal>.</para>
  1551. <para>For information about the file specified by <replaceable>path/filename
  1552. </replaceable>, see overview comment file.</para>
  1553. <para>Note that the overview page is created only if you pass into <command>
  1554. javadoc</command> two or more package names. For further explanation, see <literal>
  1555. HTML Frames</literal>.</para>
  1556. <para>The title on the overview page is set by <option>doctitle</option>.
  1557. </para>
  1558. </listitem></varlistentry>
  1559. <varlistentry><term><option>public</option> </term><listitem><para>Shows only
  1560. public classes and members.</para>
  1561. </listitem></varlistentry>
  1562. <varlistentry><term><option>protected</option> </term><listitem><para>Shows
  1563. only protected and public classes and members. This is the default.</para>
  1564. </listitem></varlistentry>
  1565. <varlistentry><term><option>package</option> </term><listitem><para>Shows
  1566. only package, protected, and public classes and members.</para>
  1567. </listitem></varlistentry>
  1568. <varlistentry><term><option>private</option> </term><listitem><para>Shows
  1569. all classes and members.</para>
  1570. </listitem></varlistentry>
  1571. <varlistentry><term><option>help</option> </term><listitem><para>Displays
  1572. the online help, which lists these <command>javadoc</command> and doclet command
  1573. line options.</para>
  1574. </listitem></varlistentry>
  1575. <varlistentry><term><option>doclet</option> <replaceable>class</replaceable> 
  1576. </term><listitem><para>Specifies the class file that starts the doclet used
  1577. in generating the documentation. Use the fully-qualified name. This doclet
  1578. defines the content and formats the output. If the <option>doclet</option>
  1579. option is not used, <command>javadoc</command> uses the standard doclet for
  1580. generating the default HTML format. This class must contain the <literal>
  1581. start(Root)</literal> method. The path to this starting class is defined by
  1582. the <option>docletpath</option> option.</para>
  1583. <para>For example, to call the MIF doclet, use:<informalexample>
  1584. <screen>-doclet com.sun.tools.doclets.mif.MIFDoclet</screen>
  1585. </informalexample></para>
  1586. </listitem></varlistentry>
  1587. <varlistentry><term><option>docletpath</option> <replaceable>classpathlist
  1588. </replaceable> </term><listitem><para>Specifies the path to the doclet starting
  1589. class file (specified with the <option>doclet</option> option) and any <acronym>
  1590. JAR</acronym> files it depends on .If the starting class file is in a jar
  1591. file, then this specifies the path to that jar file, as shown in the example
  1592. below. You can specify an absolute path or a path relative to the current
  1593. directory. If <replaceable>classpathlist</replaceable> contains multiple paths
  1594. or <acronym>JAR</acronym> files, they should be separated with a colon (:)
  1595. on Solaris and a semi-colon (;) on Windows. This option is not necessary if
  1596. the doclet is already in the search path. </para>
  1597. <para>Example of path to jar file that contains the starting doclet class
  1598. file. Notice the jar filename is included. <informalexample>
  1599. <screen> -docletpath /home/user/mifdoclet/lib/mifdoclet.jar</screen>
  1600. </informalexample></para>
  1601. <para>Example of path to starting doclet class file. Notice the class filename
  1602. is omitted. <informalexample>
  1603. <screen>-docletpath /home/user/mifdoclet/classes/com/sun/tools/doclets/mif/
  1604. </screen>
  1605. </informalexample></para>
  1606. </listitem></varlistentry>
  1607. <varlistentry><term><option>1.1</option> </term><listitem><para> This feature
  1608. has been removed from <command>javadoc</command> 1.4. There is no replacement
  1609. for it. This option created documentation with the appearance and functionality
  1610. of documentation generated by <command>javadoc</command> 1.1 (including never
  1611. supporting nested classes). If you need this option, use <command>javadoc
  1612. </command> 1.2 or 1.3 instead.</para>
  1613. </listitem></varlistentry>
  1614. <varlistentry><term><option>sourcepath</option> <replaceable>sourcepathlist
  1615. </replaceable> </term><listitem><para>Specifies the search paths for finding
  1616. source files (<literal>.java</literal>) when passing package names into the <command>
  1617. javadoc</command> command. The sourcepathlist can contain multiple paths by
  1618. separating them with a colon (:). The Javadoc tool will search in all subdirectories
  1619. of the specified paths. Note that this option is not only used to locate 
  1620.            the source files being documented, but also to find source files
  1621. that are not being documented but whose comments are inherited by the source
  1622. files being documented.</para>
  1623. <para> Notice that you can use the <option>sourcepath</option> option only
  1624. when passing package names into the <command>javadoc</command> command —
  1625. it will not locate <literal>.java</literal> files passed into the <command>
  1626. javadoc</command> command. (To locate <literal>.java</literal> files, cd to
  1627. that directory or include the path ahead of each file, as shown at <literal>
  1628. Documenting One or More Classes</literal>.)  If <option>sourcepath</option>
  1629. is omitted, <command>javadoc</command> uses the class path to find the source
  1630. files (see <option>classpath</option>). Therefore, the default <option>sourcepath
  1631. </option> is the value of class path. If  <option>classpath</option> is omitted
  1632. and you are passing package names into <command>javadoc</command>, it looks
  1633. in the current directory (and subdirectories) for the source files.</para>
  1634. <para>Set <replaceable>sourcepathlist</replaceable> to the root directory
  1635. of the source tree for the package you are documenting. For example, suppose
  1636. you want to document a package called <literal>com.mypackage</literal> whose
  1637. source files are located at:<informalexample><para><screen>/home/user/src/com/mypackage/*.java
  1638. </screen></para>
  1639. </informalexample>In this case, you would specify the source path to <literal>
  1640. /home/user/src</literal>, the directory that contains <literal>com/mypackage
  1641. </literal>, and then supply the package name <literal>com.mypackage</literal>:<informalexample>
  1642. <para><screen>example% <userinput>javadoc –sourcepath /home/user/src/ com.mypackage
  1643. </userinput></screen></para>
  1644. </informalexample>This is easy to remember by noticing that if you concatenate
  1645. the value of the source path and the package name together and change the
  1646. dot to a slash "/", you end up with the full path to the package:<informalexample>
  1647. <para><literal>/home/user/src/com/mypackage</literal></para>
  1648. </informalexample></para>
  1649. <para>To point to two source paths:<informalexample>
  1650. <screen>example% <userinput>javadoc -sourcepath /home/user1/src:/home/user2/src\
  1651.          com.mypackage</userinput></screen>
  1652. </informalexample></para>
  1653. </listitem></varlistentry>
  1654. <varlistentry><term><option>classpath</option> <replaceable>classpathlist
  1655. </replaceable> </term><listitem><para>Specifies the paths where <command>
  1656. javadoc</command> will look for referenced classes (<literal>.class</literal>) —
  1657. these are the documented classes plus any classes referenced by those classes.
  1658.  The Javadoc tool searches in all subdirectories of the specified paths. The
  1659. class path list can contain multiple paths by separating them with a colon.
  1660. The Javadoc tool will search in all subdirectories of the specified paths.
  1661. Follow the instructions in class path documentation for specifying <replaceable>
  1662. classpathlist</replaceable>.</para>
  1663. <para>If <option>sourcepath</option> is omitted, the Javadoc tool uses <option>
  1664. classpath</option> to find the source files as well as class files (for backward
  1665. compatibility). Therefore, if you want to search for source and class files
  1666. in separate paths, use both <option>sourcepath</option> and <option>classpath
  1667. </option>.</para>
  1668. <para>For example, if you want to document <literal>com.mypackage</literal>,
  1669. whose source files reside in the directory <literal>/home/user/src/com/mypackage
  1670. </literal>, and if this package relies on a library in <literal>/home/user/lib
  1671. </literal>, you would specify:<informalexample><para><screen>example% <userinput>
  1672. javadoc –classpath /home/user/lib –sourcepath \
  1673.                /home/user/src com.mypackage</userinput></screen></para>
  1674. </informalexample></para>
  1675. <para>As with other tools, if you do not specify <option>classpath</option>,
  1676. the Javadoc tool uses the <envar>CLASSPATH</envar> environment variable, if
  1677. it is set. If both are not set, the Javadoc tool searches for classes from
  1678. the current directory.</para>
  1679. <para>For an in-depth description of how the Javadoc tool uses <option>classpath
  1680. </option> to find user classes as it relates to extension classes and bootstrap
  1681. classes, see <literal>How Classes Are Found</literal>.</para>
  1682. </listitem></varlistentry>
  1683. <varlistentry><term><option>bootclasspath</option> <replaceable>classpathlist
  1684. </replaceable> </term><listitem><para>Specifies the paths where the boot classes
  1685. reside. These are nominally the Java platform classes. The <literal>bootclasspath
  1686. </literal> is part of the search path the Javadoc tool will use to look up
  1687. source and class files. See How Classes Are Found for more details. Separate
  1688. directories in <replaceable>dirlist</replaceable> with colons (:).</para>
  1689. </listitem></varlistentry>
  1690. <varlistentry><term><option>extdirs</option> <replaceable>dirlist</replaceable> 
  1691. </term><listitem><para>Specifies the directories where extension classes reside.
  1692. These are any classes that use the Java Extension mechanism. The <literal>
  1693. extdirs</literal> is part of the search path the Javadoc tool uses to look
  1694. up source and class files. See <option>classpath</option> (above) for more
  1695. details. Separate directories in <replaceable>dirlist</replaceable> with colons
  1696. (:).</para>
  1697. </listitem></varlistentry>
  1698. <varlistentry><term><option>verbose</option> </term><listitem><para>Provides
  1699. more detailed messages while <command>javadoc</command> is running. Without
  1700. the <option>verbose</option> option, messages appear for loading the source
  1701. files, generating the documentation (one message per source file), and sorting.
  1702. The <option>verbose</option> option causes the printing of additional messages
  1703. specifying the number of milliseconds to parse each Java source file.</para>
  1704. </listitem></varlistentry>
  1705. <varlistentry><term>quiet</term><listitem><para>Shuts off non-error and non-warning
  1706. messages, leaving only the warnings and errors appear, making them easier
  1707. to view. Also suppresses the version             string. </para>
  1708. </listitem></varlistentry>
  1709. <varlistentry><term><option>locale</option> <replaceable>language_country_variant
  1710. </replaceable> </term><listitem><para><emphasis>Important:</emphasis> The <option>
  1711. locale</option> option must be placed ahead (to the left) of any options provided
  1712. by the standard doclet or any other doclet. Otherwise, the navigation bars
  1713. will appear in English. This is the only command-line option that is order-dependent.
  1714. </para>
  1715. <para>Specifies the locale that <command>javadoc</command> uses when generating
  1716. documentation. The argument is the name of the locale, as described in <literal>
  1717. java.util.Locale</literal> documentation, such as <literal>en_US</literal>
  1718. (English, United States) or <literal>en_US_WIN</literal> (Windows variant).
  1719. </para>
  1720. <para>Specifying a locale causes <command>javadoc</command> to choose the
  1721. resource files of that locale for messages (strings in the navigation bar,
  1722. headings for lists and tables, help file contents, comments in <literal>stylesheet.css
  1723. </literal>, and so forth). It also specifies the sorting order for lists sorted
  1724. alphabetically, and the sentence separator to determine the end of the first
  1725. sentence. It does not determine the locale of the doc comment text specified
  1726. in the source files of the documented classes.</para>
  1727. </listitem></varlistentry>
  1728. <varlistentry><term><option>encoding</option> <replaceable>name</replaceable> 
  1729. </term><listitem><para>Specifies the source file encoding name, such as EUCJIS/SJIS.
  1730. If this option is not specified, the platform default converter is used.</para>
  1731. </listitem></varlistentry>
  1732. <varlistentry><term><option>J</option><replaceable>flag</replaceable> </term>
  1733. <listitem><para>Passes flag directly to the runtime system java that runs <command>
  1734. javadoc</command>. Notice there must be no space between the <option>J</option>
  1735. and the flag. For example, if you need to ensure that the system sets aside
  1736. 32 megabytes of memory in which to process the generated documentation, then
  1737. you would call the <option>Xmx</option> option of <command>java</command>
  1738. as follows (<option>Xms</option> is optional, as it only sets the size of
  1739. initial memory, which is useful if you know the minimum amount of memory required):<informalexample>
  1740. <para><screen>example% <userinput>javadoc –J–Xmx32m –J–Xms32m com.mypackage
  1741. </userinput></screen></para>
  1742. </informalexample></para>
  1743. <para>To tell what version of javadoc you are using, call the <option>version
  1744. </option> option of java: <informalexample>
  1745. <screen>% javadoc -J-version
  1746.                java version "1.2"
  1747.                Classic VM (build JDK-1.2-V, green threads, sunwjit)</screen>
  1748. </informalexample></para>
  1749. <para>(The version number of the standard doclet appears in its output stream.) 
  1750. </para>
  1751. </listitem></varlistentry>
  1752. </variablelist></refsect2>
  1753. <refsect2>
  1754. <title>Options Provided by the Standard Doclet</title>
  1755. <variablelist termlength="wholeline">
  1756. <varlistentry><term><option>d</option> <replaceable>directory</replaceable> 
  1757. </term><listitem><para>Specifies the destination directory where <command>
  1758. javadoc</command> saves the generated HTML files. (The "d" means "destination.")
  1759.  Omitting this option causes the files to be saved to the current directory.
  1760. The value <replaceable>directory</replaceable> can be absolute or relative
  1761. to the current working directory. As of 1.4, the destination directory is
  1762. automatically created when javadoc is run. </para>
  1763. <para> For example, the following generates the documentation for the <literal>
  1764. com.mypackage</literal> package and saves the results in the <literal>/home/user/doc/
  1765. </literal> directory:<informalexample><para><screen>example% <userinput>javadoc –d /home/user/doc com.mypackage
  1766. </userinput></screen></para>
  1767. </informalexample></para>
  1768. </listitem></varlistentry>
  1769. <varlistentry><term><option>use</option> </term><listitem><para>Includes one
  1770. "Use" page for each documented class and package. The page describes what
  1771. packages, classes, methods, constructors, and fields use any API of the given
  1772. class or package. Given class C, things that use class C would include subclasses
  1773. of C, fields declared as C, methods that return C, and methods and constructors
  1774. with parameters of type C.</para>
  1775. <para>For example, let's look at what might appear on the "Use" page for <literal>
  1776. String</literal>. The <literal>getName()</literal> method in the <literal>
  1777. java.awt.Font</literal> class returns type <literal>String</literal>. Therefore, <literal>
  1778. getName()</literal> uses <literal>String</literal>, and you will find that
  1779. method on the "Use" page for <literal>String</literal>.</para>
  1780. <para>Notice that this page documents only uses of the <acronym>API</acronym>,
  1781. not the implementation. If a method uses <literal>String</literal> in its
  1782. implementation but does not take a string as an argument or return a string,
  1783. that is not considered a "use" of <literal>String</literal>.</para>
  1784. <para>You can access the generated "Use" page by first going to the class
  1785. or package, then clicking on the "Use" link in the navigation bar.</para>
  1786. </listitem></varlistentry>
  1787. <varlistentry><term><option>version</option> </term><listitem><para>Includes
  1788. the <literal>@version</literal> text in the generated docs. This text is omitted
  1789. by default.To tell what version of the Javadoc tool you are using, use the<option>
  1790.  J-version</option> option. </para>
  1791. </listitem></varlistentry>
  1792. <varlistentry><term><option>author</option> </term><listitem><para>Includes
  1793. the <literal>@author</literal> text in the generated docs.</para>
  1794. </listitem></varlistentry>
  1795. <varlistentry><term><option>splitindex</option> </term><listitem><para>Splits
  1796. the index file into multiple files, alphabetically, one file per letter, plus
  1797. a file for any index entries that start with non-alphabetical characters.
  1798. </para>
  1799. </listitem></varlistentry>
  1800. <varlistentry><term><option>windowtitle</option> <replaceable>title</replaceable> 
  1801. </term><listitem><para>Specifies the title to be placed in the HTML <literal>
  1802. <title></literal> tag. This appears in the window title and in any browser
  1803. bookmarks (favorite places) that someone creates for this page. This title
  1804. should not contain any HTML tags, as the browser cannot properly interpret
  1805. them. Any internal quotation marks within <replaceable>title</replaceable>
  1806. might have to be escaped. If <option>windowtitle</option> is omitted, the
  1807. Javadoc tool uses the value of <option>doctitle</option> for this option.
  1808. </para>
  1809. <informalexample>
  1810. <screen> % javadoc -windowtitle "Java 2 Platform" com.mypackage
  1811.  
  1812. </screen>
  1813. </informalexample>
  1814. </listitem></varlistentry>
  1815. <varlistentry><term><option>doctitle</option> <replaceable>title</replaceable> 
  1816. </term><listitem><para>Specifies the title to be placed near the top of the
  1817. overview summary file. The title is placed as a centered, level-one heading
  1818. directly beneath the upper navigation bar. The <replaceable>title</replaceable>
  1819. can contain HTML tags and white space, though if it does, it must be enclosed
  1820. in quotes. Any internal quotation marks within <replaceable>title</replaceable>
  1821. might have to be escaped.</para>
  1822. <informalexample>
  1823. <screen> % javadoc -doctitle "Java <sup><font size=\"-2\">TM</font></sup>" com.mypackage
  1824. </screen>
  1825. </informalexample>
  1826. </listitem></varlistentry>
  1827. <varlistentry><term><option>title</option> <replaceable>title</replaceable> 
  1828. </term><listitem><para>This option no longer exists. It existed only in Beta
  1829. versions of <command>javadoc</command> 1.2. It has been renamed to <option>
  1830. doctitle</option>. This option was renamed to make it clear that it defines
  1831. the document title rather than the window title.</para>
  1832. </listitem></varlistentry>
  1833. <varlistentry><term><option>header</option> <replaceable>header</replaceable> 
  1834. </term><listitem><para>Specifies the header text to be placed at the top of
  1835. each output file. The header is placed to the right of the upper navigation
  1836. bar. <replaceable>header</replaceable> can contain HTML tags and white space,
  1837. though if it does, it must be enclosed in quotes. Any internal quotation marks
  1838. within <replaceable>header</replaceable> may have to be escaped.</para>
  1839. <informalexample>
  1840. <screen> % javadoc -header "<b>Java 2 Platform</b><br>v1.4" com.mypackage
  1841.  
  1842. </screen>
  1843. </informalexample>
  1844. </listitem></varlistentry>
  1845. <varlistentry><term><option>footer</option> <replaceable>footer</replaceable> 
  1846. </term><listitem><para>Specifies the footer text to be placed at the bottom
  1847. of each output file. The footer is placed to the right of the lower navigation
  1848. bar. <replaceable>footer</replaceable> can contain HTML tags and white space,
  1849. though if it does, it must be enclosed in quotes. Any internal quotation marks
  1850. within <replaceable>footer</replaceable> may have to be escaped.</para>
  1851. </listitem></varlistentry>
  1852. <varlistentry><term><option>bottom</option> <replaceable>text</replaceable> 
  1853. </term><listitem><para>Specifies the text to be placed at the bottom of each
  1854. output file. The text is placed at the bottom of the page, below the lower
  1855. navigation bar. <replaceable>text</replaceable> can contain HTML tags and
  1856. white space, though if it does, it must be enclosed in quotes. Any internal
  1857. quotation marks within <replaceable>text</replaceable> may have to be escaped.
  1858. </para>
  1859. </listitem></varlistentry>
  1860. <varlistentry><term><option>link</option> <replaceable>extdocURL</replaceable> 
  1861. </term><listitem><para>Creates links to existing <command>javadoc</command>-generated
  1862. documentation of external referenced classes. It takes one argument:</para>
  1863. <itemizedlist>
  1864. <listitem><para><replaceable>extdocURL</replaceable> is the absolute or relative
  1865. URL of the directory containing the external javadoc-generated documentation
  1866. you want  to link to. Examples are shown below. The package-list file must
  1867. be found in this directory (otherwise, use <literal>linkoffline</literal>).
  1868. The Javadoc tool reads the package names from the package-list file and then
  1869. links to those packages at that URL. When the Javadoc tool is run, the <replaceable>
  1870. extdocURL</replaceable> value is copied literally into the into the <A
  1871. HREF> links that are created. Therefore,<replaceable> extdocURL</replaceable>
  1872. must be the URL to the directory, not to a file. </para>
  1873. <para>You can use an absolute link for <replaceable>extdocURL</replaceable>
  1874. to enable your docs to link to a document on any website, or can use a relative
  1875. link to link only                   to a relative location. If relative, the
  1876. value you pass in should be the relative path from the destination directory
  1877. (specified with <option>d</option>) to the directory containing the packages
  1878. being linked to. </para>
  1879. <para>When specifying an absolute link you normally use an <literal>http:
  1880. </literal> link. However, if you want to link to a file system that has no
  1881. web server, you                   can use a <literal>file:</literal> link
  1882. -- however, do this only if everyone wanting to access the generated documentation
  1883. shares the same file system. </para>
  1884. </listitem>
  1885. </itemizedlist>
  1886. <para><emphasis>Choosing between</emphasis> <option>linkoffline</option><emphasis>
  1887.  and</emphasis> <option>link</option> </para>
  1888. <para>One or the other option is appropriate when linking to an <acronym>
  1889. API</acronym> document that is external to the current javadoc run. </para>
  1890. <para>Use <option>link</option>: </para>
  1891. <para><itemizedlist>
  1892. <listitem><para>when using a relative path to the external <acronym>API</acronym>
  1893. document, or </para>
  1894. </listitem>
  1895. <listitem><para>when using an absolute URL to the external <acronym>API</acronym>
  1896. document, if your shell allows a program to open a connection to that URL
  1897. for reading. </para>
  1898. </listitem>
  1899. </itemizedlist></para>
  1900. <para>Use <option>linkoffline</option>: </para>
  1901. <itemizedlist>
  1902. <listitem><para>when using an absolute URL to the external <acronym>API</acronym>
  1903. document, if your shell does not allow a program to open a connection to that
  1904. URL for  reading. This can occur if you are behind a firewall and the document
  1905. you want to link to is on the other side. </para>
  1906. </listitem>
  1907. </itemizedlist>
  1908. <para><emphasis>Example using absolute links to the external docs</emphasis></para>
  1909. <para>Let's say you want to link to the<literal> java.lang</literal>, <literal>
  1910. java.io</literal> and other Java 2 Platform packages at http://java.sun.com/j2se/1.4/docs/api,
  1911. The             following command generates documentation for the package <literal>
  1912. com.mypackage</literal> with links to the Java 2 Platform packages. The generated
  1913. documentation             will contain links to the <literal>Object</literal>
  1914. class, for example, in the class trees. (Other options, such as <option>sourcepath
  1915. </option> and <option>d</option>, are not shown.) </para>
  1916. <informalexample>
  1917. <screen>% javadoc -link http://java.sun.com/j2se/1.4/docs/api com.mypackage
  1918.  
  1919. </screen>
  1920. </informalexample>
  1921. <para><emphasis>Example using relative links to the external docs </emphasis></para>
  1922. <para>Let's say you have two packages whose docs are generated in different
  1923. runs of the Javadoc tool, and those docs are separated by a relative path.
  1924. In this example, the packages are <literal>com.apipackage</literal>, an <acronym>
  1925. API</acronym>, and<literal> com.spipackage</literal>, an <acronym>SPI</acronym>
  1926. (Service Provide Interface). You want the documentation to reside in <literal>
  1927. docs/api/com/apipackage</literal> and             <literal>docs/spi/com/spipackage
  1928. </literal>. Assuming the <acronym>API</acronym> package documentation is already
  1929. generated, and that docs is the current directory, you would document the <acronym>
  1930. SPI</acronym> package with links to the <acronym>API</acronym> documentation
  1931. by running: </para>
  1932. <informalexample>
  1933. <screen>% javadoc -d ./spi -link ../api com.spipackage
  1934.  
  1935. </screen>
  1936. </informalexample>
  1937. <para>Notice the <option>link</option> argument is relative to the destination
  1938. directory (<literal>docs/spi</literal>).</para>
  1939. <para><emphasis>Details</emphasis> </para>
  1940. <para>The <option>link</option> option enables you to link to classes referenced
  1941. to by your code but not documented in the current javadoc run. For these links
  1942. to go to valid pages, you must know where those HTML pages are located, and
  1943. specify that location with <replaceable>extdocURL</replaceable>. This allows,
  1944. for instance, third party documentation to link to<literal> java.*</literal>
  1945. documentation on http://java.sun.com. </para>
  1946. <para>Omit the <option>link</option> option for javadoc to create links only
  1947. to <acronym>API</acronym> within the documentation it is generating in the
  1948. current run. (Without the <option>link</option> option, the Javadoc tool does
  1949. not create links to documentation             for external references, because
  1950. it does not know if or where that documentation exists.) </para>
  1951. <para>You can specify multiple <option>link</option> options in a given javadoc
  1952. run to link to multiple documents. </para>
  1953. <para>Another use is for cross-links between sets of packages: Execute <command>
  1954. javadoc</command> on one set of packages, then run <command>javadoc</command>
  1955. again on another set of packages, creating links both ways between both sets.
  1956. A third use is as a "hack" to update docs: Execute <command>javadoc</command>
  1957. on a full set of packages, then run <command>javadoc</command> again on only
  1958. the smaller set of changed packages, so that the updated files can be inserted
  1959. back into the original set.</para>
  1960. <para><emphasis>Bug Fix for Referenced Classes</emphasis> </para>
  1961. <para>In 1.4 the following bug has been fixed: <itemizedlist>
  1962. <listitem><para>Link bug in 1.2 and 1.3 - When <literal>@see</literal> or <literal>
  1963. {@link}</literal> references an excluded class and <option>link</option> is
  1964. used, an                    and <option>link</option> is used, an <A HREF>
  1965. hyperlink is created only if the class is referenced either in an import statement
  1966. or in a declaration.                   References in the body of methods,
  1967. alone, are inadequate. A workaround                   was to include an explicit
  1968. (not wildcard) import statement for the referenced class. </para>
  1969. </listitem>
  1970. </itemizedlist></para>
  1971. <para>An <literal>@see</literal> or <literal>{@link}</literal> reference with <option>
  1972. link</option> is now enough to load the referenced class and enable a link
  1973. to it. You can remove any import statements you had added as workarounds,
  1974. which we had suggested you comment as follows: </para>
  1975. <informalexample>
  1976. <screen> import java.lang.SecurityManager; // workaround to force @see/@link hyperlink
  1977.  
  1978. </screen>
  1979. </informalexample>
  1980. <para><emphasis>Package List:</emphasis> The <option>link</option> option
  1981. requires that a file named <literal>package-list</literal>, which is generated
  1982. by  <command>javadoc</command>the Javadoc tool, exist at the URL you specify
  1983. with <option>link</option>. The  <literal>package-list</literal> file is a
  1984. simple text file that lists the names of packages documented at that location.
  1985. In the earlier example, the Javadoc tool looks for a file named <literal>
  1986. package-list</literal> at the given URL, reads in the package names and then
  1987. links to those packages at that URL. </para>
  1988. <para>For example, the package list for the Java 2 Platform v1.4 API is located
  1989. at<informalexample><para><ulink url="http://java.sun.com/products/jdk/1.2/docs/api/package-list">
  1990. http://java.sun.com/products/jdk/1.2/docs/api/package-list</ulink></para>
  1991. </informalexample></para>
  1992. <para>and starts out as follows:<informalexample><para><screen>java.applet
  1993. java.awt
  1994. java.awt.color
  1995. java.awt.datatransfer
  1996. java.awt.dnd
  1997. java.awt.event
  1998. java.awt.font
  1999. etc.</screen></para>
  2000. </informalexample></para>
  2001. <para>When <command>javadoc</command> is run without the <option>link</option>
  2002. option, when it encounters a name that belongs to an external referenced class,
  2003. it prints the name with no link. However, when the <option>link</option> option
  2004. is used, <command>javadoc</command> searches the <literal>package-list</literal>
  2005. file at the specified <replaceable>extdocURL</replaceable> location for that
  2006. package name. If it finds the package name, it prefixes the name with that
  2007. URL. </para>
  2008. <para>In order for there to be no broken links, all of the documentation for
  2009. the external references must exist at the specified URLs. The Javadoc tool
  2010. does not check that these pages exist — only that the <literal>package-list
  2011. </literal> exists.</para>
  2012. <para>The <literal>package-list</literal> file is created but is empty if
  2013. the argument to <command>javadoc</command> is source files rather than packages.
  2014. </para>
  2015. <para><emphasis>Multiple Links:</emphasis> You can supply multiple <option>
  2016. link</option> options to link to any number of external generated documents.
  2017. Javadoc 1.2 has a known bug that prevents you from supplying more than one <option>
  2018. link</option> command. This was fixed in 1.2.2.</para>
  2019. <para>Specify a different link option for each external document to link to:<informalexample>
  2020. <para><screen>example% <userinput>javadoc –link extdocURL1 –link extdocURL2 ...\
  2021.                  –link extdocURLn com.mypackage</userinput></screen></para>
  2022. </informalexample>where <literal>extdocURL1</literal>, <literal>extdocURL2
  2023. </literal>, <literal>... extdocURLn</literal> point respectively to the roots
  2024. of external documents, each of which contains a file named <literal>package-list
  2025. </literal>.</para>
  2026. <para><emphasis>Cross Links:</emphasis> Notice that "bootstrapping" might
  2027. be required when cross-linking two or more documents that have not been previously
  2028. generated. In other words, if  <literal>package-list</literal> does not exist
  2029. for either document, when you run the Javadoc tool on the first document,
  2030. the <literal>package-list</literal> does not yet exist for the second document.
  2031. Therefore, to create the external links, you must re-generate the first document
  2032. after generating the second document.</para>
  2033. <para>In this case, the purpose of first generating a document is to create
  2034. its <literal>package-list</literal> (or you can create it by hand if you are
  2035. certain of the package names). Then generate the second document with its
  2036. external links. The Javadoc tool prints a warning if a needed external  <literal>
  2037. package-list</literal> file does not exist.</para>
  2038. </listitem></varlistentry>
  2039. <varlistentry><term><option>linkoffline</option> <replaceable>extdocURL  packagelistLoc
  2040. </replaceable> </term><listitem><para>This option is a variation of <option>
  2041. link</option>; they both create links to documentation for external referenced
  2042. classes. Use the <option>linkoffline</option>  option when linking to a document
  2043. on the web when the Javadoc tool itself is "offline" -- that is, it cannot
  2044. access the document through a web connection.</para>
  2045. <para>More specifically, use <option>linkoffline</option> if the external
  2046. document's <literal>package-list</literal> file is not accessible or does
  2047. not exist at the <replaceable>extdocURL</replaceable> location but does exist
  2048. at a different location, which can be specified by <replaceable>packageListLoc
  2049. </replaceable> (typically local). Thus, if<replaceable> extdocURL</replaceable>
  2050. is accessible only on the World Wide Web, <option>linkoffline</option> removes
  2051. the constraint that the Javadoc tool have a web connection when generating
  2052. the documentation. Examples are given below. </para>
  2053. <para>The <option>linkoffline</option> option takes two arguments --  the
  2054. first for the string to be embedded in the the first for the string to be
  2055. embedded in the <a href> links, the second telling it where to find <literal>
  2056. package-list</literal>:  </para>
  2057. <para><variablelist termlength="narrow">
  2058. <varlistentry><term><replaceable>extdocURL</replaceable></term><listitem>
  2059. <para>is the absolute or relative URL of the directory containing the external <command>
  2060. javadoc</command>-generated documentation you want to link to. If relative,
  2061. the value should be the relative path from the destination directory     
  2062.              (specified with <option>d</option>) to the root of the packages
  2063.                   being linked to. For more details, see  <replaceable>extdocURL
  2064. </replaceable> in the <option>link</option> option.</para>
  2065. </listitem></varlistentry>
  2066. <varlistentry><term><replaceable>packagelistLoc</replaceable></term><listitem>
  2067. <para>is the path or URL to the directory containing the <literal>package-list
  2068. </literal> file for                 the external documentation. This can be
  2069. a URL  (http: or file:) or file path, and can be absolute or relative. If
  2070. relative, make it relative to the current directory from where javadoc was
  2071. run. Do not include the<literal> package-list</literal> filename. </para>
  2072. </listitem></varlistentry>
  2073. </variablelist></para>
  2074. <para>You can specify multiple <option>linkoffline</option> options in a 
  2075. given javadoc run. (Prior to 1.2.2, it could be specified only once.) </para>
  2076. <para><emphasis>Example using absolute links to the external docs </emphasis></para>
  2077. <para> Let's say you want to link to the <literal>java.lang</literal>, <literal>
  2078. java.io</literal> and other Java 2 Platform packages at http://java.sun.com/j2se/1.4/docs/api,
  2079. but your             shell does not have web access. You could open the <literal>
  2080. package-list</literal> file in a browser at http://java.sun.com/j2se/1.4/docs/api/package-list,
  2081. save it to a local directory, and point to this local copy with the second
  2082. argument, <replaceable>packagelistLoc</replaceable>. In this example, the
  2083. package list file has been saved to the current directory "." . The following
  2084. command generates documentation for the package<literal> com.mypackage </literal>with
  2085. links to the Java 2 Platform packages. The generated documentation will contain
  2086. links to the <literal>Object</literal> class, for example, in the class trees.
  2087. (Other necessary options, such as <option>sourcepath</option>, are not shown.) <informalexample>
  2088. <screen>% javadoc -linkoffline http://java.sun.com/j2se/1.4/docs/api . com.mypackage
  2089.  
  2090. </screen>
  2091. </informalexample></para>
  2092. <para><emphasis>Example using relative links to the external docs</emphasis> 
  2093. </para>
  2094. <para>It's not very common to use <option>linkoffline</option> with relative
  2095. paths, for the simple reason that <option>link</option> usually suffices.
  2096. When using <option>linkoffline</option>, the <literal>package-list</literal>
  2097. file is generally local, and when using             relative links, the file
  2098. you are linking to is also generally local. So it is usually unnecessary to
  2099. give a different path for the two arguments to <option>linkoffline</option>.
  2100. When the two arguments are identical, you can use <option>link</option>. See
  2101. the <option>link</option> relative example. </para>
  2102. <para><emphasis>Manually Creating A</emphasis> <literal>package-list</literal><emphasis>
  2103.  File</emphasis></para>
  2104. <para>If a <literal>package-list</literal> file does not yet exist, but you
  2105. know what package names your document will link to, you can create your own
  2106. copy of this file by hand and specify its path with <replaceable>packagelistLoc
  2107. </replaceable>. An example would be the previous case where the package list
  2108. for <literal>com.spipackage</literal> did not exist when <literal>com.apipackage
  2109. </literal> was first generated. This technique is useful when you need to
  2110. generate documentation that links to new external documentation whose package
  2111. names you know, but which is not yet published. This is also a way of creating
  2112. a <literal>package-list</literal> file for linking to documentation generated
  2113. with <command>Javadoc</command> 1.0 or 1.1, earlier versions where <literal>
  2114. package-list</literal> files were not generated. Likewise, two companies can
  2115. share their unpublished <literal>package-list</literal> files, enabling them
  2116. to release their cross-linked documentation simultaneously. </para>
  2117. <para><emphasis>Linking to Multiple Documents</emphasis></para>
  2118. <para>You can include <option>linkoffline</option> once for each generated
  2119. document you want to refer to (each option is shown on a separate line for
  2120. clarity):<informalexample>
  2121. <screen>example% <userinput>javadoc -linkoffline extdocURL1 packagelistLoc1\
  2122.                  -linkoffline extdocURL2 packagelistLoc2\
  2123.               ...</userinput></screen>
  2124. </informalexample></para>
  2125. <para><emphasis>Updating Docs:</emphasis> The third use for the  <option>
  2126. linkoffline</option> option is useful if your project has dozens or hundreds
  2127. of packages; if you have already run <command>javadoc</command> on the entire
  2128. tree; and now, in a separate run, you want to quickly make some small changes
  2129. and re-run <command>javadoc</command> on just a small portion of the source
  2130. tree. This is somewhat of a hack in that it works properly only if your changes
  2131. are only to doc comments and not to signatures. If you were to add, remove,
  2132. or change any signatures from the source code, then broken links could show
  2133. up in the index, package tree, inherited member lists, use page, or other
  2134. places.</para>
  2135. <para>First, you create a new destination directory (call it update) for this
  2136. new small run. Set the first argument of <option>linkoffline</option> to the
  2137. current directory ”.” and set the second argument to the relative
  2138. path to the original docs (call it html), where it can find package-list:<informalexample>
  2139. <para><screen>example% <userinput>javadoc –d update –linkoffline<?Pub Caret> . html com.mypackage
  2140. </userinput></screen></para>
  2141. </informalexample></para>
  2142. <para>When <command>javadoc</command> is done, copy these generated class
  2143. pages (not the overview or index) in <literal>update</literal> over the original
  2144. files in <literal>html</literal>.</para>
  2145. </listitem></varlistentry>
  2146. </variablelist>
  2147. <variablelist>
  2148. <varlistentry><term>linksource</term><listitem><para>Creates an HTML version
  2149. of each source file (with line numbers) and adds links to them from the standard
  2150. HTML documentation. This option exposes all private implementation details
  2151. in the included source files, including private classes, private fields, and
  2152. the bodies of private methods, regardless of the <option>public</option>, <option>
  2153. package</option>, <option>protected</option> and <option>private</option>
  2154. options. Unless you also use the <option>private</option> option, not all
  2155. private classes or interfaces will necessarily be accessible via links. </para>
  2156. </listitem></varlistentry>
  2157. </variablelist>
  2158. <variablelist termlength="wholeline">
  2159. <varlistentry><term><option>group</option> <replaceable>groupheading  packagepattern:packagepattern:..
  2160. </replaceable> </term><listitem><para>Separates packages on the overview page
  2161. into whatever groups you specify, one group per table. You specify each group
  2162. with a different <option>group</option> option. The groups appear on the page
  2163. in the order specified on the command line; packages are alphabetized within
  2164. a group. For a given <option>group</option> option, the packages matching
  2165. the list of <replaceable>packagepattern</replaceable> expressions appear in
  2166. a table with the heading <replaceable>groupheading</replaceable>.<itemizedlist>
  2167. <listitem><para><replaceable>groupheading</replaceable> can be any text, and
  2168. can include white space. This text is placed in the table heading for the
  2169. group.</para>
  2170. </listitem>
  2171. <listitem><para><replaceable>packagepattern</replaceable> can be any package
  2172. name, or can be the start of any package name followed by an asterisk (*).
  2173. The asterisk is a wildcard meaning "match any characters". This is the only
  2174. wildcard allowed. Multiple patterns can be included in a group by separating
  2175. them with colons (:).</para>
  2176. </listitem>
  2177. </itemizedlist><emphasis>Note:</emphasis> If using an asterisk in a pattern
  2178. or pattern list, the pattern list must be inside quotes, such as "java.lang*:java.util".
  2179. </para>
  2180. <para>If you do not supply any <option>group</option> option, all packages
  2181. are placed in one group with the heading "Packages". If the all groups do
  2182. not include all documented packages, any leftover packages appear in a separate
  2183. group with the heading "Other Packages".</para>
  2184. <para>For example, the following option separates the four documented packages
  2185. into core, extension, and other packages. Notice the trailing "dot" does not
  2186. appear in "<literal>java.lang*</literal>". Including the dot, such as "<literal>
  2187. java.lang.*</literal>", would omit the <literal>java.lang</literal> package:<informalexample>
  2188. <para><screen>example% <userinput>javadoc –group "Core Packages" "java.lang*:java.util" \
  2189.     –group "Extension Packages" "javax.*" \
  2190.     java.lang java.lang.reflect java.util javax.servlet java.new</userinput></screen></para>
  2191. </informalexample></para>
  2192. <para>This results in the groupings:</para>
  2193. <informalexample><para><screen>Core Packages
  2194.   java.lang
  2195.   java.lang.reflect
  2196.   java.util
  2197. Extension Packages
  2198.   javax.servlet
  2199. Other Packages
  2200.   java.new</screen></para>
  2201. </informalexample>
  2202. </listitem></varlistentry>
  2203. <varlistentry><term><option>nodeprecated</option> </term><listitem><para>
  2204. Prevents the generation of any deprecated <acronym>API</acronym> at all in
  2205. the documentation. This does what <option>nodeprecatedlist</option> does,
  2206. plus it does not generate any deprecated <acronym>API</acronym> throughout
  2207. the rest of the documentation. This is useful when writing code and you do
  2208. not want to be distracted by the deprecated code.</para>
  2209. </listitem></varlistentry>
  2210. <varlistentry><term><option>nodeprecatedlist</option> </term><listitem><para>
  2211. Prevents the generation of the file containing the list of deprecated <acronym>
  2212. API</acronym>s (<literal>deprecated-list.html</literal>) and the link in the
  2213. navigation bar to that page. (However, <command>javadoc</command> continues
  2214. to generate the deprecated <acronym>API</acronym> throughout the rest of the
  2215. document.)  This is useful if your source code contains no deprecated <acronym>
  2216. API</acronym>, and you want to make the navigation bar cleaner.</para>
  2217. </listitem></varlistentry>
  2218. <varlistentry><term><option>nosince</option></term><listitem><para>Omits from
  2219. the generated docs the "Since" sections associated with the <literal>@since
  2220. </literal> tags. </para>
  2221. </listitem></varlistentry>
  2222. <varlistentry><term><option>notree</option> </term><listitem><para>Omits the
  2223. class/interface hierarchy from the generated docs. The hierarchy is produced
  2224. by default.</para>
  2225. </listitem></varlistentry>
  2226. <varlistentry><term><option>noindex</option> </term><listitem><para>Omits
  2227. the index from the generated docs. The index is produced by default.</para>
  2228. </listitem></varlistentry>
  2229. <varlistentry><term><option>nohelp</option> </term><listitem><para>Omits the
  2230. HELP link in the navigation bars at the top and bottom of each page of output.
  2231. </para>
  2232. </listitem></varlistentry>
  2233. <varlistentry><term><option>nonavbar</option> </term><listitem><para>Prevents
  2234. the generation of the navigation bar, header and footer, otherwise found at
  2235. the top and bottom of the generated pages. Has no effect on the "bottom" option.
  2236. The <option>nonavbar</option> option is useful when you are interested only
  2237. in the content and have no need for navigation, such as converting the files
  2238. to PostScript or PDF for print only.</para>
  2239. </listitem></varlistentry>
  2240. <varlistentry><term><option>helpfile</option> <replaceable>path/filename</replaceable> 
  2241. </term><listitem><para>Specifies the path of an alternate help file <replaceable>
  2242. path/filename</replaceable> that the HELP link in the top and bottom navigation
  2243. bars link to. Without this option, the Javadoc tool automatically creates
  2244. a help file <literal>help-doc.html</literal> that is hard-coded in the Javadoc
  2245. tool. This option enables you to override this default. The file name can
  2246. be any name and is not restricted to <literal>help-doc.html</literal>. The
  2247. Javadoc tool will adjust the links in the navigation bar accordingly. For
  2248. example:<informalexample><para><screen>example% <userinput>javadoc –helpfile /home/doc/myhelp.html java.awt
  2249. </userinput></screen></para>
  2250. </informalexample></para>
  2251. </listitem></varlistentry>
  2252. <varlistentry><term><command>stylesheetfile</command> <replaceable>path/filename
  2253. </replaceable> </term><listitem><para>Specifies the path of an alternate HTML
  2254. stylesheet file. Without this option, the Javadoc tool automatically creates
  2255. a stylesheet file, <literal>stylesheet.css</literal>, that is hard-coded in
  2256. the Javadoc tool. This option enables you to override this default. The file
  2257. name can be any name and is not restricted to <literal>stylesheet.css</literal>.
  2258. For example:<informalexample><para><screen>example% <userinput>javadoc –stylesheetfile \
  2259.             /home/doc/mystylesheet.css java.awt</userinput></screen></para>
  2260. </informalexample></para>
  2261. </listitem></varlistentry>
  2262. <varlistentry><term><option>serialwarn</option> </term><listitem><para>Generates
  2263. compile-time warnings for missing <literal>@serial</literal> tags. By default, <command>
  2264. Javadoc</command> 1.2.2 (and later versions) generates no serial warnings.
  2265. (This is a reversal from earlier versions.)  Use this option to display the
  2266. serial warnings, which helps to properly document default serializable fields
  2267. and writeExternal methods.</para>
  2268. </listitem></varlistentry>
  2269. <varlistentry><term><option>charset</option> <replaceable>name</replaceable> 
  2270. </term><listitem><para>Specifies the HTML character set for this document.
  2271. For example:<informalexample><para><screen>example% <userinput>javadoc –charset "iso-8859-1" mypackage
  2272. </userinput></screen></para>
  2273. </informalexample>would insert the following line in the head of every generated
  2274. page:<informalexample>
  2275. <screen><META http-equiv="Content-Type" content="text/html; charset=iso-885 9-1">
  2276. </screen>
  2277. </informalexample>This META tag is described in the HTML standard (4197265
  2278. and 4137321).</para>
  2279. </listitem></varlistentry>
  2280. <varlistentry><term><option>docencoding</option> <replaceable>name</replaceable> 
  2281. </term><listitem><para>Specifies the encoding of the generated HTML files.
  2282. </para>
  2283. </listitem></varlistentry>
  2284. <varlistentry><term><option>source  1.4 </option></term><listitem><para>Necessary
  2285. to enable javadoc to handle assertions present in J2SE v 1.4 source code.
  2286. This option documents code that compiles using "javac -source  1.4", </para>
  2287. </listitem></varlistentry>
  2288. <varlistentry><term><option>tag</option><replaceable>tagname:Xaoptcmf:"taghead"
  2289. </replaceable></term><listitem><para>Enables javadoc to interpret a simple,
  2290. one-argument custom standalone tag <literal>@tagname</literal> in doc comments.
  2291. So the Javadoc tool can "spell-check" tag names, it is important to include
  2292. a <option>tag</option> option for every custom tag that is present in the
  2293. source code, disabling (with X) those that are not being output in the current
  2294. run.</para>
  2295. <para>The <option>tag</option> option outputs the tag's heading taghead in
  2296. bold, followed on the next line by the text from its single argument, as shown
  2297. in the example below.             Like any standalone tag, this argument's
  2298. text can contain inline tags, which are also interpreted. The output is similar
  2299. to standard one-argument tags, such as <literal>@return</literal> and <literal>
  2300. @author</literal>. </para>
  2301. <para><emphasis>Placement of tags</emphasis> </para>
  2302. <para>The <replaceable>Xaoptcmf</replaceable> part of the argument determines
  2303. where in the source code the tag is allowed to be placed, and whether the
  2304. tag can be disabled (using X). You can supply either a, to allow the tag in
  2305. all places, or any combination of theother letters: </para>
  2306. <screen>X (disable tag)
  2307.                   a (all)
  2308.                   o (overview)
  2309.                   p (packages)
  2310.                   t (types, that is classes and interfaces)
  2311.                   c (constructors)
  2312.                   m (methods)
  2313.                   f (fields) </screen>
  2314. <para><emphasis>Examples of single tags</emphasis> - An example of a tag option
  2315. for a tag that that can be used anywhere in the source code is: </para>
  2316. <informalexample>
  2317. <screen> -tag todo:a:"To Do:"</screen>
  2318. </informalexample>
  2319. <para>If you wanted <literal>@todo</literal> to be used only with constructors,
  2320. methods and fields, you would use: </para>
  2321. <informalexample>
  2322. <screen> -tag todo:cmf:"To Do:"</screen>
  2323. </informalexample>
  2324. <para>Notice the last colon (:) above is not a parameter separator, but is
  2325. part of the heading text (as shown below). You would use either tag option
  2326. for source code that contains the tag <literal>@todo</literal>, such as: 
  2327. </para>
  2328. <informalexample>
  2329. <screen>@todo The documentation for this method needs work.</screen>
  2330. </informalexample>
  2331. <para>This line would produce output something like: </para>
  2332. <informalexample>
  2333. <screen>To Do: 
  2334.                        The documentation for this
  2335.                        method needs work. </screen>
  2336. </informalexample>
  2337. <para><emphasis>Spell-checking tag names (Disabling tags)</emphasis> -  Some
  2338. developers put custom tags in the source code that they don't always want
  2339. to output. In these cases, it is important to list all tags that are present
  2340. in the source code, enabling the ones you want to output and disabling the
  2341. ones you don't want to output. The presence of X disables the tag, while its
  2342. absence enables the tag. This gives the Javadoc tool  enough information to
  2343. know if a tag it encounters is  unknown, probably the results of a typo or
  2344. a misspelling. It prints a warning in these cases. </para>
  2345. <para>You can add X to the placement values already present, so that when
  2346. you want to enable the tag, you can simply delete the X. For example, if <literal>
  2347. @todo</literal> is  a tag that you want to suppress on output, you would use: 
  2348. </para>
  2349. <informalexample>
  2350. <screen>   -tag todo:Xcmf:"To Do:"</screen>
  2351. </informalexample>
  2352. <para>or, if you'd rather keep it simple: </para>
  2353. <informalexample>
  2354. <screen> -tag todo:X</screen>
  2355. </informalexample>
  2356. <para>The syntax <option>tag todo:X</option> works even if <literal>@todo
  2357. </literal> is defined by a taglet. </para>
  2358. <para><emphasis>Order of tags</emphasis> - The order of the <option>tag</option>
  2359. (and <option>taglet</option>) options determine the order the tags are output.
  2360. You can mix the custom tags with the standard tags to intersperse them. The
  2361. tag options for standard tags are placeholders only for determining the order
  2362. --  they take only the standard tag's name. (Subheadings for standard    
  2363.         tags cannot be altered.) This is illustrated in the following example.
  2364. </para>
  2365. <para>If <option>tag</option> is missing, then the position of <option>taglet
  2366. </option> determines its             order. If they are both present, then
  2367. whichever appears last on the command line determines its order. (This happens
  2368. because the tags and taglets are processed in the order that they appear on
  2369. the             command line. For example, if <option>taglet</option> and <option>
  2370. tag</option> both have the name "todo", the one that appears last on the command
  2371. line will determine its order. </para>
  2372. <para><emphasis>Example of a complete set of tags</emphasis> - This example
  2373. inserts "To Do" after "Parameters" and before "Throws" in the output. By using
  2374. "X", it also specifies that <literal>@example</literal> is a tag that might
  2375. be encountered in the source code that should not be output during       
  2376.      this run. Notice that if you use<literal> @argfile</literal>, you can
  2377. put the tags on separate lines in an argument file like this (no line continuation
  2378. characters needed): </para>
  2379. <informalexample>
  2380. <screen>-tag param
  2381.                -tag return
  2382.                -tag todo:a:"To Do:"
  2383.                -tag throws
  2384.                -tag see
  2385.                -tag example:X</screen>
  2386. </informalexample>
  2387. <para>When javadoc parses the doc comments, any tag encountered that is neither
  2388. a standard tag nor passed in with <option>tag</option> or <option>taglet</option>
  2389. is considered unknown, and a warning is thrown.</para>
  2390. <para>The standard tags are initially stored internally in a list in their
  2391. default order. Whenever <option>tag</option> options are used, those tags
  2392. get appended to this list -- standard tags are moved from their default position.
  2393. Therefore, if a <option>tag</option> option is omitted for a standard tag,
  2394. it remains in its default position. </para>
  2395. <para><emphasis>Avoiding Conflicts</emphasis> - If you want to slice out your
  2396. own namespace, you can use a dot-separated naming convention similar to that
  2397. used for packages: <literal>com.mycompany.todo</literal>. Sun will continue
  2398. to create standard tags whose names do not contain dots. Any tag you create
  2399. will override the behavior of a tag by the same name defined by Sun. In other
  2400. words, if you create a tag or taglet <literal>@todo</literal>, it will always
  2401. have the same behavior you define, even if Sun later creates a standard tag
  2402. of the same name. </para>
  2403. <para>You can also create more complex standalone tags, or custom inline tags
  2404. with the <option>taglet</option> option. </para>
  2405. </listitem></varlistentry>
  2406. <varlistentry><term><option>taglet</option>  <replaceable>class</replaceable> 
  2407. </term><listitem><para>Specifies the class file that starts the taglet used
  2408. in generating the documentation for that tag. Use the fully-qualified name
  2409. for class. This taglet also defines the number of text arguments that the
  2410. custom tag has. The taglet accepts those arguments, processes them, and generates
  2411. the output. For extensive documentation with example taglets, see Taglet Overview.
  2412. </para>
  2413. <para>Taglets are useful for standalone or inline tags. They can have any
  2414. number of arguments and implement custom behavior, such as making text bold,
  2415. formatting bullets, writing out the text to a file, or starting other processes. 
  2416. </para>
  2417. <para>Taglets can only determine where a tag should appear and in what form.
  2418. All other decisions are made by the doclet. So a taglet cannot do things such
  2419. as remove a class name from the list of included classes. However, it can
  2420. execute side effects, such as printing the tag's text to a file or triggering
  2421. another process. </para>
  2422. <para>Use the <option>tagletpath</option> option to specify the path to the
  2423. taglet. Here is an example that inserts the "To Do" taglet after "Parameters"
  2424. and ahead of "Throws" in the generated pages: </para>
  2425. <informalexample>
  2426. <screen> -taglet com.sun.tools.doclets.ToDoTaglet
  2427.                 -tagletpath /home/taglets 
  2428.                 -tag return
  2429.                 -tag param
  2430.                 -tag todo
  2431.                 -tag throws
  2432.                 -tag see</screen>
  2433. </informalexample>
  2434. <para>Alternatively, you can use the <option>taglet</option> option in place
  2435. of its <option>tag</option> option, but that may be harder to read. </para>
  2436. </listitem></varlistentry>
  2437. <varlistentry><term><option>tagletpath</option>  <replaceable>tagletpathlist
  2438. </replaceable></term><listitem><para>Specifies the search paths for finding
  2439. taglet class files (.class). The <replaceable>tagletpathlist</replaceable>
  2440. can contain multiple paths by separating them with a colon (:). The Javadoc
  2441. tool will search in all subdirectories of the specified paths. </para>
  2442. </listitem></varlistentry>
  2443. <varlistentry><term><option>subpackages</option>  <replaceable>package1:package2:...
  2444. </replaceable> </term><listitem><para>Generates documentation from source
  2445. files in the specified packages and recursively in their subpackages. This
  2446. option is useful when adding new subpackages to the source code, as they are
  2447.             automatically included. Each package is any top-level package
  2448. (<literal>java</literal>) or fully qualified subpackage (<literal>javax.swing
  2449. </literal>), and does not need to contain source files. Wildcards are not
  2450. needed or allowed. Use <option>sourcepath</option> to specify where to find
  2451. the packages. For example: </para>
  2452. <informalexample>
  2453. <screen> % javadoc -sourcepath /home/user/src -subpackages java -exclude java.net:java.lang
  2454. </screen>
  2455. </informalexample>
  2456. <para>This command generates documentation for packages named "java" and "javax.swing"
  2457. and all their subpackages. </para>
  2458. <para>There is also an option to exclude subpackages as it traverses the subpackages. 
  2459. </para>
  2460. </listitem></varlistentry>
  2461. <varlistentry><term><option>exclude</option>  <replaceable>packagename1:packagename2:...
  2462. </replaceable> </term><listitem><para>Unconditionally excludes the specified
  2463. packages and their subpackages from the list formed by <option>subpackages
  2464. </option>. It excludes those packages even if they would otherwise be included
  2465. by some             previous or later -subpackages option. For example: </para>
  2466. <informalexample>
  2467. <screen>% javadoc -sourcepath /home/user/src -subpackages java -exclude java.net:java.lang
  2468.  
  2469. </screen>
  2470. </informalexample>
  2471. <para>would include<literal> java.io</literal>,<literal> java.util</literal>,
  2472. and<literal> java.math</literal> (among others), but would exclude packages
  2473. rooted at<literal> java.net</literal> and <literal>java.lang</literal>. Notice
  2474. this excludes<literal> java.lang.ref</literal>, a subpackage of <literal>
  2475. java.lang</literal>). </para>
  2476. </listitem></varlistentry>
  2477. <varlistentry><term><option>breakiterator</option> </term><listitem><para>
  2478. Uses the sentence break iterator to determine the end of the first sentence.
  2479. We plan to change the algorithm for determining the end of the first sentence
  2480. in the next major feature release -- the <option>breakiterator</option> option
  2481. uses this new algorithm. We recommend you use this option whenever running
  2482. version 1.4 so that your             transition to the next major release
  2483. will be seamless. </para>
  2484. <para>In 1.2 and 1.3, the <literal>java.text.BreakIterator</literal> class
  2485. was used to determine the end of sentence for all languages but English. 
  2486. Therefore, the <option>breakiterator</option> option has an effect only for
  2487. English. English had its own algorithm, which looked for a period        
  2488.     followed by a space. When <option>breakiterator</option> is omitted, the
  2489. end of the first sentence is unchanged from 1.2 and 1.3, and warnings are
  2490. emitted displaying where there would be a difference. </para>
  2491. <para>Differences in the algorithms show up in English as follows: </para>
  2492. <itemizedlist>
  2493. <listitem><para>Old algorithm - Stops at a period followed by a space or a
  2494. paragraph-level HTML tag, such as <P>.</para>
  2495. </listitem>
  2496. <listitem><para>New algorithm - Stops at a period, question mark or exclamation
  2497. mark followed by a space if the next word starts with a capital letter. This
  2498. is meant to handle most abbreviations (such as "Serial no. is valid", but
  2499. won't handle "Mr. Smith"). Won't stop at HTML tags or sentences that begin
  2500. with numbers or symbols. </para>
  2501. </listitem>
  2502. </itemizedlist>
  2503. </listitem></varlistentry>
  2504. <varlistentry><term><option>docfilessubdirs</option>  </term><listitem><para>
  2505. Enables deep copying of "doc-files" directories. In other words, subdirectories
  2506. and all contents are recursively copied to the             destination. For
  2507. example, the directory <literal>doc-files/example/images</literal> and all
  2508. its contents would now be copied. There is also an option to exclude subdirectories. 
  2509. </para>
  2510. </listitem></varlistentry>
  2511. <varlistentry><term><option>excludedocfilessubdir</option> <replaceable>name1:name2...
  2512. </replaceable> </term><listitem><para>Excludes any "doc-files" subdirectories
  2513. with the given names. This prevents the copying of SCCS and other source-code-control
  2514. subdirectories. </para>
  2515. </listitem></varlistentry>
  2516. <varlistentry><term><option>noqualifier</option>  <literal>all</literal> 
  2517. |  <replaceable>packagename1:packagename2:...</replaceable> </term><listitem>
  2518. <para>Omits qualifying package name from ahead of class names in output. The
  2519. argument to <option>noqualifier</option> is either "all" (all package qualifiers
  2520. are omitted) or a colon-separate list of packages, with wildcards, to be removed
  2521. as qualifiers. The package name is          removed from places where class
  2522. or interface names appear. </para>
  2523. <para>The following example omits all package qualifiers: </para>
  2524. <informalexample>
  2525. <screen>  -noqualifier all</screen>
  2526. </informalexample>
  2527. <para>The following example omits "java.lang" and "java.io" package qualifiers: 
  2528. </para>
  2529. <informalexample>
  2530. <screen>  -noqualifier java.lang:java.io</screen>
  2531. </informalexample>
  2532. <para>The following example omits package qualifiers starting with       
  2533.      "java", and "com.sun" subpackages (but not "javax"): </para>
  2534. <informalexample>
  2535. <screen>  -noqualifier java.*:com.sun.*</screen>
  2536. </informalexample>
  2537. <para>Where a package qualifier would appear due to the above behavior, the
  2538. following behavior (present in 1.3) also takes effect to further omit qualifiers:
  2539. On the page for class <literal>p.C</literal>, remove the package qualifier
  2540. for classes belonging to package <literal>p</literal>. This rule is present
  2541. whether or not <option>noqualifier</option> is used. </para>
  2542. </listitem></varlistentry>
  2543. <varlistentry><term><option>nocomment</option> </term><listitem><para> Suppress
  2544. the entire comment body, including the description and all tags, generating
  2545. only declarations. This option enables re-using source files originally intended
  2546. for a different purpose, to produce a skeleton perhaps for a new project. 
  2547. </para>
  2548. </listitem></varlistentry>
  2549. </variablelist></refsect2>
  2550. </refsect1>
  2551. <refsect1><title>COMMAND LINE ARGUMENT FILES</title>
  2552. <para>To shorten or simplify the <command>javadoc</command> command, you can
  2553. specify one or more files that themselves contain arguments to the <command>
  2554. javadoc</command> command (except <option>J</option> options). This enables
  2555. you to create javadoc commands of any length on any operating system.</para>
  2556. <para>An argument file can include Javadoc options, source filenames and package
  2557. names in any combination, or just arguments to Javadoc options. The arguments
  2558. within a file can be space-separated or newline-separated. Filenames within
  2559. an argument file are relative to the current directory, not the location of
  2560. the argument file. Wildcards (*) are not allowed in these lists (such as for
  2561. specifying *.java). Use of the '@' character to recursively interpret files
  2562. is not supported. The <option>J</option> options are not supported because
  2563. they are passed to the launcher, which does not support argument files. </para>
  2564. <para> When executing <command>javadoc</command>, pass in the path and name
  2565. of each argument file with the '<literal>@</literal>' leading character. When <command>
  2566. javadoc</command> encounters an argument beginning with the character '@',
  2567. it expands the contents of that file into the argument list.</para>
  2568. <example>
  2569. <title>Example - Single Arg File</title>
  2570. <para>You could use a single argument file named "argfile" to hold all Javadoc
  2571. arguments: </para>
  2572. <informalexample>
  2573. <screen> % javadoc @argfile
  2574.  
  2575. </screen>
  2576. </informalexample>
  2577. <para>This argument file could contain the contents of both files shown in
  2578. the next example. </para>
  2579. </example>
  2580. <example>
  2581. <title>Example - Two Arg Files</title>
  2582. <para>You can create two argument files -- one for the Javadoc options and
  2583. the other for the package names or source filenames: (Notice the following
  2584. lists have no line-continuation characters.) </para>
  2585. <para>Create a file named "options" containing: </para>
  2586. <informalexample>
  2587. <screen>  -d docs-filelist 
  2588.            -use 
  2589.            -splitindex
  2590.            -windowtitle 'Java 2 Platform v1.3 API Specification'
  2591.            -doctitle 'Java<sup><font size="-2>TM</font></sup> 2 Platform v1.4 API Specification'
  2592.            -header '<b>Java 2 Platform </b><br><font size="-1">v1.4</font>'
  2593.            -bottom 'Copyright 1993-2000 Sun Microsystems, Inc. All Rights Reserved.'
  2594.            -group "Core Packages" "java.*"
  2595.            -overview /java/pubs/ws/1.3/src/share/classes/overview-core.html
  2596.            -sourcepath /java/pubs/ws/1.3/src/share/classes</screen>
  2597. </informalexample>
  2598. <para>Create a file named "packages" containing: </para>
  2599. <informalexample>
  2600. <screen> com.mypackage1
  2601.            com.mypackage2
  2602.            com.mypackage3</screen>
  2603. </informalexample>
  2604. <para>You would then run javadoc with: </para>
  2605. <informalexample>
  2606. <screen>  % javadoc @options @packages
  2607.  
  2608. </screen>
  2609. </informalexample>
  2610. </example>
  2611. <example>
  2612. <title>Example - Arg Files with Paths</title>
  2613. <para>The argument files can have paths, but any filenames inside the files
  2614. are relative to the current working directory (not path1 or path2): </para>
  2615. <informalexample>
  2616. <screen>  % javadoc @path1/options @path2/packages
  2617.  
  2618. </screen>
  2619. </informalexample>
  2620. </example>
  2621. <example>
  2622. <title>Example - Option Arguments</title>
  2623. <para>Here's an example of saving just an argument to a javadoc option in
  2624. an argument file. We'll use the <option>bottom</option> option, since it can
  2625. have a lengthy argument. You could create a file named "bottom" containing
  2626. its text argument: </para>
  2627. <informalexample>
  2628. <screen>'<font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a 
  2629. bug or feature</a></br></br>Java is a trademark or registered trademark of 
  2630. Microsystems, Inc. 901 San Antonio Road,<br>Palo Alto, California, 94303, U.S.A. 
  2631. All Rights Reserved.</font>'</screen>
  2632. </informalexample>
  2633. <para>Then run the Javadoc tool with: </para>
  2634. <informalexample>
  2635. <screen>  % javadoc -bottom @bottom @packages
  2636.  
  2637. </screen>
  2638. </informalexample>
  2639. <para>Or you could include the <option>bottom</option> option at the start
  2640. of the argument file, and then just run it as: </para>
  2641. <informalexample>
  2642. <screen>% javadoc @bottom @packages</screen>
  2643. </informalexample>
  2644. </example>
  2645. </refsect1>
  2646. <refsect1><title>Running Javadoc</title>
  2647. <para><emphasis>Version Numbers</emphasis> - The version number of <command>
  2648. javadoc</command> can be determined using <command>javadoc</command><option>
  2649.  J-version</option>. The version number of the standard doclet appears in
  2650. its output stream. It can be turned off with <option>quiet</option>. </para>
  2651. <para><emphasis>Public programmatic interface</emphasis> - To invoke the Javadoc
  2652. tool from within programs written in the Java language. This interface is
  2653. in <literal>com.sun.tools.javadoc.Main</literal> (and javadoc is re-entrant).
  2654. For more details, see Standard Doclet. </para>
  2655. </refsect1>
  2656. <refsect1><title>Simple Examples</title>
  2657. <para>You can run <command>javadoc</command> on entire packages or individual
  2658. classes. Each package name has a corresponding directory name. In the following
  2659. examples, the source files are located at <literal>/home/src/java/awt/*java
  2660. </literal>. The destination directory is <literal>/home/html</literal>.</para>
  2661. <example role="example">
  2662. <title>Documenting One or More Packages</title>
  2663. <para>To document a package, the source files (*<literal>.java</literal>)
  2664. for that package must be located in a directory having the same name as the
  2665. package. If a package name is made up of several identifiers (separated by
  2666. dots such as <literal>java.awt.color</literal>), each subsequent identifier
  2667. must correspond to a deeper subdirectory (such as <literal>java/awt/color
  2668. </literal>) . You may split the source files for a single package among two
  2669. such directory trees located at different places, as long as <option>sourcepath
  2670. </option> points to them both -- for example <literal>src1/java/awt/color
  2671. </literal> and <literal>src2/java/awt/color</literal>. </para>
  2672. <para>You can run <command>javadoc</command> either by changing directories
  2673. (with cd) or by using <option>sourcepath</option> option. The examples below
  2674. illustrate both alternatives. </para>
  2675. <itemizedlist>
  2676. <listitem><para><emphasis>Case 1 - Run recursively starting from one or more
  2677. packages - </emphasis> This example uses <option>sourcepath</option> so javadoc
  2678. can be run from any directory. It traverses the subpackages of java excluding
  2679.             packages rooted at<literal> java.net</literal> and <literal>java.lang
  2680. </literal>. Notice this excludes <literal>java.lang.ref</literal>, a subpackage
  2681. of <literal>java.lang</literal>). <informalexample><para><screen>  % javadoc  -d /home/html -sourcepath /home/src -subpackages java -exclude java.net:java.lang
  2682.  
  2683. </screen></para>
  2684. </informalexample></para>
  2685. <para>To also traverse down other package trees, append their names to the <option>
  2686. subpackages</option> argument, such as<literal> java:javax:org.xml.sax</literal>. 
  2687. </para></listitem>
  2688. <listitem><para><emphasis>Case 2 - Run on explicit packages after changing
  2689. to the "root" source directory -</emphasis>Change to the parent directory
  2690. of the fully-qualified package. Then run <command>javadoc</command>, supplying
  2691. names of one or more packages you want to document:  <informalexample><para><screen>
  2692. % cd /home/src/
  2693.               % javadoc -d /home/html java.awt java.awt.event
  2694.  
  2695. </screen></para>
  2696. </informalexample></para></listitem>
  2697. <listitem><para><emphasis>Case 3 - Run from any directory on explicit packages
  2698. in a single directory tree -</emphasis> In this case, it doesn't matter what
  2699. the current directory is. Run <command>javadoc</command> supplying <option>
  2700. sourcepath</option> with the parent directory of the top-level package, and
  2701. supplying names of one or more packages you want to document: </para>
  2702. <informalexample>
  2703. <screen> % javadoc -d /home/html -sourcepath /home/src java.awt java.awt.event
  2704.  
  2705. </screen>
  2706. </informalexample>
  2707. </listitem>
  2708. <listitem><para><emphasis>Case 4 - Run from any directory on explicit packages
  2709. in multiple directory trees -</emphasis> This is the same as case 3, but for
  2710. packages in separate directory trees. Run <command>javadoc</command> supplying <option>
  2711. sourcepath</option> with the path to each tree's root (colon-separated) and
  2712. supply names of one or more packages you want to document. All source files
  2713. for a given package do not need to be located under  a single root directory
  2714. -- they just need to be found somewhere along the sourcepath. </para></listitem>
  2715. </itemizedlist>
  2716. <para>Result: All cases generate HTML-formatted documentation for the public
  2717. and protected classes and interfaces in packages <literal>java.awt</literal>
  2718. and <literal>java.awt.event</literal> and save the HTML files in the specified
  2719. destination directory (<literal>/home/html</literal>). Because two or more
  2720. packages are being generated, the document has three frames — for the
  2721. list of packages, the list of classes, and the main page.</para>
  2722. </example>
  2723. <example role="example">
  2724. <title>Documenting One or More Classes</title>
  2725. <para>The second way to run the Javadoc tool is by passing in one or more
  2726. source files (<literal>.java</literal>). You can run <command>javadoc</command>
  2727. either of the following two ways: by changing directories (with cd) or by
  2728. fully specifying the path to the <literal>.java</literal> files. Relative
  2729. paths are relative to the current directory. The <option>sourcepath</option>
  2730. option is ignored when passing in source files. You can use command line wildcards,
  2731. such as asterisk (*), to specify groups of classes.</para>
  2732. <itemizedlist>
  2733. <listitem><para><emphasis>Case 1 — Changing to the source directory:
  2734. </emphasis> Change to the directory holding the <literal>.java</literal> files.
  2735. Then run <command>javadoc</command>, supplying names of one or more source
  2736. files you want to document.<informalexample><para><screen>example% <userinput>
  2737. cd /home/src/java/awt</userinput>
  2738. example% <userinput>javadoc –d /home/html Button.java Canvas.java \
  2739.                Graphics*.java</userinput></screen></para>
  2740. </informalexample></para>
  2741. <para>This example generates HTML-formatted documentation for the classes <literal>
  2742. Button</literal>, <literal>Canvas</literal>, and classes beginning with <literal>
  2743. Graphics</literal>. Because source files rather than package names were passed
  2744. in as arguments to <command>javadoc</command>, the document has two frames —
  2745. for the list of classes and the main page.</para></listitem>
  2746. <listitem><para><emphasis>Case 2 - Changing to the package:</emphasis> <literal>
  2747. 2</literal> This is useful for documenting individual source files from different
  2748. subpackages off the same root. Change to the package root directory, and supply
  2749. the source files with paths from the root.<informalexample><para><screen>
  2750. example% <userinput>cd /home/src/</userinput>
  2751. example% <userinput>javadoc –d /home/html java/awt/Button.java \
  2752.                  java/applet/Applet.java</userinput></screen></para>
  2753. </informalexample></para>
  2754. <para>This example generates HTML-formatted documentation for the classes <literal>
  2755. Button</literal> and <literal>Applet</literal>.</para></listitem>
  2756. <listitem><para><emphasis>Case 3 - From any directory:</emphasis> In this
  2757. case, it does not matter what the current directory is. Run <command>javadoc
  2758. </command>, supplying the absolute path (or path relative to the current directory)
  2759. to the <literal>.java</literal> files you want to document:<informalexample>
  2760. <para><screen>example% <userinput>javadoc –d /home/html /home/src/java/awt/Button.java \
  2761.                /home/src/java/awt/Graphics*.java</userinput></screen></para>
  2762. </informalexample></para>
  2763. <para>This example generates HTML-formatted documentation for the class <literal>
  2764. Button</literal> and classes beginning with <literal>Graphics</literal>.</para>
  2765. </listitem>
  2766. </itemizedlist>
  2767. </example>
  2768. <example role="example">
  2769. <title>Documenting Both Packages and Classes</title>
  2770. <para>You can document entire packages and individual classes at the same
  2771. time. Here is an example that mixes the two previous examples. You can use <option>
  2772. sourcepath</option> for the path to the packages but not for the path to the
  2773. individual classes:<informalexample><para><screen>example% <userinput>javadoc –d /home/html –sourcepath /home/src java.awt \
  2774.                /home/src/java/applet/Applet.java</userinput></screen></para>
  2775. </informalexample></para>
  2776. <para>This example generates HTML-formatted documentation for the package <literal>
  2777. java.awt</literal> and <literal>class Applet</literal> (<command>javadoc</command>
  2778. determines the package name for <literal>Applet</literal> from the package
  2779. declaration, if any, in the <literal>Applet.java</literal> source file.)</para>
  2780. </example>
  2781. <example role="example">
  2782. <title>Real World Example</title>
  2783. <para>The Javadoc tool has many useful options, some of which are more commonly
  2784. used than others. Here is effectively the command we use to run the Javadoc
  2785. tool on the Java platform <acronym>API</acronym>. We use 180MB of memory to
  2786. generate the documentation for the 1500 (approx.) public and protected classes
  2787. in the Java 2 Platform, Standard Edition, v1.2.</para>
  2788. <para>The same example is shown twice — first as executed on the <emphasis>
  2789. command line</emphasis>, then as executed from a <emphasis>makefile</emphasis>.
  2790. It uses absolute paths in the option arguments, which enables the same <command>
  2791. javadoc</command> command to be run from any directory.</para>
  2792. <para><emphasis>Command Line Example</emphasis></para>
  2793. <para>This command line example is over 900 characters, which is too long
  2794. for some shells, such as <acronym>DOS</acronym>. You can use a command line
  2795. argument file (or write a shell script) to workaround this limitation.</para>
  2796. <informalexample>
  2797. <screen>example% <userinput>javadoc –sourcepath /jdk/src/share/classes             \
  2798.       -overview /java/jdk/src/share/classes/overview.html              \
  2799.       -d /java/jdk/build.api                                           \
  2800.       -use                                                             \
  2801.       -splitIndex                                                      \
  2802.       -windowtitle 'Java 2 Platform v1.2 API Specification'            \
  2803.       -doctitle 'Java<sup><font size="-2">TM</font></sup> 2\
  2804.                 Platform v1.2 API Specification'                       \
  2805.       -header '<b>Java 2 Platform </b><br><font size="-1">v1.2</font>' \
  2806.       -bottom '<font size="-1"><a href="http://java.sun.com/cgi-bin/   \
  2807. bugreport.cgi">Submit a bug or feature</a><br><br>Java is a trademark  \
  2808. or registered trademark of Sun Microsystems, Inc. in the US and other  \
  2809. countries.<br>Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio \
  2810. Road,<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font>'                                     \
  2811.       -group "Core Packages" "java.*:com.sun.java.*:org.omg.*"         \
  2812.       -group "Extension Packages" "javax.*"                            \
  2813.       -J-Xmx180m                                                       \
  2814.       @packages</userinput></screen>
  2815. </informalexample>
  2816. <para>where <literal>packages</literal> is the name of a file containing the
  2817. packages to process, such as <literal>java.applet</literal> <literal>java.lang
  2818. </literal>. None of the options should contain any newline characters between
  2819. the single quotes. (For example, if you copy and paste this example, delete
  2820. the newline characters from the <option>bottom</option> option.) See the other
  2821. notes listed below.</para>
  2822. <para><emphasis>Makefile Example</emphasis></para>
  2823. <para>This is an example of a GNU makefile. For an example of a Windows makefile,
  2824. see <literal>Creating a Makefile for Windows</literal>.</para>
  2825. <informalexample>
  2826. <screen><userinput>javadoc –sourcepath $(SRCDIR)        /* Sets path for source files      */
  2827.   –overview $(SCRDIR)/overview.html  /* Sets file for overview text     */
  2828.   -d /jdk/build/api         /* Sets destination directory      */
  2829.   –use         /* Adds "Use" files                */
  2830.   –splitIndex         /* Splits index A-Z                */
  2831.   –windowtitle $(WINDOWTITLE)         /* Adds a window title             */
  2832.   –doctitle $(DOCTITLE)         /* Adds a doc title                */
  2833.   –header $(HEADER)         /* Adds running header text        */
  2834.   –bottom $(BOTTOM)         /* Adds text at bottom             */
  2835.   –group $(GROUPCORE)         /* First subhead on overview page  */
  2836.   –group $(GROUPEXT)         /* Second subhead on overview page */
  2837.   –J–Xmx180m         /* Sets memory to 180MB            */
  2838.   java.lang java.lang.reflect         /* Sets packages to document       */
  2839.   java.util java.io java.net
  2840.   java.applet
  2841.  
  2842. WINDOWTITLE = 'Java 2 Platform v1.2 API Specification'
  2843. DOCTITLE = 'Java<sup><font size="-2">TM</font></sup> 2 Platform v1.2  \
  2844.                  API Specification'
  2845. HEADER = '<b>Java 2 Platform</b><br><font size="-1">v1.2</font>'
  2846. BOTTOM = '<font size="-1"><a href="http://java.sun.com/cgi-bin/       \
  2847.               bugreport.cgi">Submit a bug or feature</a><br><br>Java  \
  2848.               is a trademark or registered trademark of Sun           \
  2849.               Microsystems, Inc. in the US and other countries.<br>   \
  2850.               Copyright 1993-1999 Sun Microsystems, Inc. 901 San      \
  2851.               Antonio Road,<br>Palo Alto, California, 94303, U.S.A.   \
  2852.               All Rights Reserved.</font>'
  2853. GROUPCORE = '"Core Packages" "java.*:com.sun.java.*:org.omg.*"'
  2854. GROUPEXT  = '"Extension Packages" "javax.*"'
  2855. SRCDIR = '/java/jdk/1.2/src/share/classes'</userinput>
  2856.  
  2857. </screen>
  2858. </informalexample>
  2859. <para>Single quotes are used to surround makefile arguments.</para>
  2860. <para><emphasis>Notes:</emphasis><itemizedlist>
  2861. <listitem><para>If you omit the <option>windowtitle</option> option, the Javadoc
  2862. tool copies the doc title to the window title. The <option>windowtitle</option>
  2863. text is basically the same as the <option>doctitle</option> but without HTML
  2864. tags, to prevent those tags from appearing as raw text in the window title. 
  2865. </para></listitem>
  2866. <listitem><para>If you omit the <option>footer</option> option, as done here,
  2867. the Javadoc tool copies the header text to the footer.</para></listitem>
  2868. <listitem><para>Other important options not needed in this example are <option>
  2869. classpath</option> and <option>link</option>.</para></listitem>
  2870. </itemizedlist></para>
  2871. </example>
  2872. </refsect1>
  2873. <refsect1><title>TROUBLESHOOTING</title>
  2874. <para><emphasis>General Troubleshooting</emphasis></para>
  2875. <itemizedlist>
  2876. <listitem><para>Javadoc FAQ - Commonly-encountered bugs and troubleshooting
  2877.  tips can be found on the <citetitle>Javadoc FAQ </citetitle></para></listitem>
  2878. <listitem><para>Bugs and Limitations - You can also see some bugs listed at <citetitle>
  2879. Important Bug Fixes and Changes</citetitle>. </para></listitem>
  2880. <listitem><para>Version number - See <literal>version numbers</literal>. 
  2881. </para></listitem>
  2882. <listitem><para>Documents only legal classes - When documenting a package, <command>
  2883. javadoc</command> only reads files whose names are composed of legal class
  2884. names. You can prevent <command>javadoc</command> from parsing a file by including,
  2885.  for example, a hyphen "-" in its filename. </para></listitem>
  2886. </itemizedlist>
  2887. <para><emphasis>Errors and Warnings</emphasis></para>
  2888. <para>Error and warning messages contain the filename and line number to the
  2889. declaration line rather than to the particular line in the doc comment. </para>
  2890. <itemizedlist>
  2891. <listitem><para>"<literal>error: cannot read: Class1.java</literal>" the Javadoc
  2892. tool is trying to load the class <literal>Class1.java</literal> in the current
  2893. directory. The class name is shown with its path (absolute or relative), which
  2894. in this case is the same as <literal>./Class1.java</literal>. </para></listitem>
  2895. </itemizedlist>
  2896. </refsect1>
  2897. <refsect1><title>&envr-tt;</title>
  2898. <variablelist termlength="medium">
  2899. <varlistentry><term remap="20"><envar>CLASSPATH</envar> </term><listitem>
  2900. <para>Environment variable that provides the path that <command>javadoc</command>
  2901. uses to find user class files. This environment variable is overridden by
  2902. the <option>classpath</option> option. Separate your directories with a colon,
  2903. as for example:<informalexample><para><screen>.:/home/classes:/usr/local/java/classes
  2904. </screen> </para>
  2905. </informalexample></para>
  2906. </listitem></varlistentry>
  2907. </variablelist></refsect1>
  2908. <refsect1><title>&also-tt;</title>
  2909. <para><citerefentry><refentrytitle>javac</refentrytitle><manvolnum>1</manvolnum>
  2910. </citerefentry>, <citerefentry><refentrytitle>java</refentrytitle><manvolnum>
  2911. 1</manvolnum></citerefentry>, <citerefentry><refentrytitle>jdb</refentrytitle>
  2912. <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>javah
  2913. </refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>
  2914. javap</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry>
  2915. <refentrytitle>attributes</refentrytitle><manvolnum>5</manvolnum></citerefentry> 
  2916. </para>
  2917. <para>See (or search <literal>java.sun.com</literal>) for the following:</para>
  2918. <variablelist termlength="wholeline">
  2919. <varlistentry><term remap="10"><citetitle>The Javadoc Home Page</citetitle>
  2920. @</term><listitem><para><ulink url="http://java.sun.com/products/jdk/javadoc/index.html">
  2921. http://java.sun.com/products/jdk/javadoc/index.html</ulink></para>
  2922. </listitem></varlistentry>
  2923. <varlistentry><term remap="10"><citetitle>Javadoc Enhancements</citetitle>
  2924. @</term><listitem><para><ulink url="http://java.sun.com/j2se/1.4/docs/tooldocs/javadoc/index.html">
  2925. http://java.sun.com/j2se/1.4/docs/tooldocs/javadoc/index.html</ulink></para>
  2926. </listitem></varlistentry>
  2927. <varlistentry><term remap="10"><citetitle>Javadoc FAQ</citetitle> @</term>
  2928. <listitem><para><ulink url="http://java.sun.com/products/jdk/javadoc/faq.html">
  2929. http://java.sun.com/products/jdk/javadoc/faq.html</ulink></para>
  2930. </listitem></varlistentry>
  2931. <varlistentry><term remap="10"><citetitle>How to Write Doc Comments</citetitle>
  2932. @</term><listitem><para><ulink url="http://java.sun.com/products/jdk/javadoc/writingdoccomments.html">
  2933. http://java.sun.com/products/jdk/javadoc/writingdoccomments.html</ulink></para>
  2934. </listitem></varlistentry>
  2935. </variablelist></refsect1>
  2936. <!--+ 08/03/00 16:09:09
  2937.     | tagMorph:  $Id: tagMorph-engine 1.54 1998/01/19 05:44:48 $
  2938.     | tagMorph library:  $Id: libtagMorph.a 1.50 1998/01/19 22:02:51 $
  2939.     | sunman-to-solbook 1.17
  2940.     +-->
  2941. </refentry>
  2942. <?Pub *0000172180>
  2943.