1javadoc(1) Basic Tools javadoc(1)
2
3
4
6 javadoc - Generates HTML pages of API documentation from Java source
7 files.
8
10 javadoc {packages|source-files} [options] [@argfiles]
11
12
13 packages
14 Names of packages that you want to document, separated by
15 spaces, for example java.lang java.lang.reflect java.awt. If you
16 want to also document the subpackages, use the -subpackages
17 option to specify the packages.
18
19 By default, javadoc looks for the specified packages in the
20 current directory and subdirectories. Use the -sourcepath option
21 to specify the list of directories where to look for packages.
22
23 source-files
24 Names of Java source files that you want to document, separated
25 by spaces, for example Class.java Object.java Button.java. By
26 default, javadoc looks for the specified classes in the current
27 directory. However, you can specify the full path to the class
28 file and use wildcard characters, for example
29 /home/src/java/awt/Graphics*.java. You can also specify the path
30 relative to the current directory.
31
32 options
33 Command-line options, separated by spaces. See Options.
34
35 @argfiles
36 Names of files that contain a list of javadoc command options,
37 package names and source file names in any order.
38
40 The javadoc command parses the declarations and documentation comments
41 in a set of Java source files and produces a corresponding set of HTML
42 pages that describe (by default) the public and protected classes,
43 nested classes (but not anonymous inner classes), interfaces,
44 constructors, methods, and fields. You can use the javadoc command to
45 generate the API documentation or the implementation documentation for
46 a set of source files.
47
48 You can run the javadoc command on entire packages, individual source
49 files, or both. When documenting entire packages, you can either use
50 the -subpackages option to recursively traverse a directory and its
51 subdirectories, or to pass in an explicit list of package names. When
52 you document individual source files, pass in a list of Java source
53 file names. See Simple Examples.
54
55 PROCESS SOURCE FILES
56 The javadoc command processes files that end in source and other files
57 described in Source Files. If you run the javadoc command by passing in
58 individual source file names, then you can determine exactly which
59 source files are processed. However, that is not how most developers
60 want to work, because it is simpler to pass in package names. The
61 javadoc command can be run three ways without explicitly specifying the
62 source file names. You can pass in package names, use the -subpackages
63 option, or use wild cards with source file names. In these cases, the
64 javadoc command processes a source file only when the file fulfills all
65 of the following requirements:
66
67 · The file name prefix (with .java removed) is a valid class name.
68
69 · The path name relative to the root of the source tree is a valid
70 package name after the separators are converted to dots.
71
72 · The package statement contains the valid package name.
73
74 Processing Links
75
76 During a run, the javadoc command adds cross-reference links to
77 package, class, and member names that are being documented as part of
78 that run. Links appear in the following places. See Javadoc Tags for a
79 description of the @ tags.
80
81 · Declarations (return types, argument types, and field types).
82
83 · See Also sections that are generated from @see tags.
84
85 · Inline text generated from {@link} tags.
86
87 · Exception names generated from @throws tags.
88
89 · Specified by links to interface members and Overrides links to class
90 members. See Method Comment Inheritance.
91
92 · Summary tables listing packages, classes and members.
93
94 · Package and class inheritance trees.
95
96 · The index.
97
98 You can add links to existing text for classes not included on the
99 command line (but generated separately) by way of the -link and
100 -linkoffline options.
101
102 Processing Details
103
104 The javadoc command produces one complete document every time it runs.
105 It does not do incremental builds that modify or directly incorporate
106 the results from earlier runs. However, the javadoc command can link to
107 results from other runs.
108
109 The javadoc command implementation requires and relies on the Java
110 compiler. The javadoc command calls part of the javac command to
111 compile the declarations and ignore the member implementations. The
112 javadoc command builds a rich internal representation of the classes
113 that includes the class hierarchy and use relationships to generate the
114 HTML. The javadoc command also picks up user-supplied documentation
115 from documentation comments in the source code. See Documentation
116 Comments.
117
118 The javadoc command runs on source files that are pure stub files with
119 no method bodies. This means you can write documentation comments and
120 run the javadoc command in the early stages of design before API
121 implementation.
122
123 Relying on the compiler ensures that the HTML output corresponds
124 exactly with the actual implementation, which may rely on implicit,
125 rather than explicit, source code. For example, the javadoc command
126 documents default constructors that are present in the compiled class
127 files but not in the source code.
128
129 In many cases, the javadoc command lets you generate documentation for
130 source files with incomplete or erroneous code. You can generate
131 documentation before all debugging and troubleshooting is done. The
132 javadoc command does primitive checking of documentation comments.
133
134 When the javadoc command builds its internal structure for the
135 documentation, it loads all referenced classes. Because of this, the
136 javadoc command must be able to find all referenced classes, whether
137 bootstrap classes, extensions, or user classes. See How Classes Are
138 Found at
139 http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
140
141 Typically, classes you create must either be loaded as an extension or
142 in the javadoc command class path.
143
144 JAVADOC DOCLETS
145 You can customize the content and format of the javadoc command output
146 with doclets. The javadoc command has a default built-in doclet, called
147 the standard doclet, that generates HTML-formatted API documentation.
148 You can modify or make a subclass of the standard doclet, or write your
149 own doclet to generate HTML, XML, MIF, RTF or whatever output format
150 you want.
151
152 When a custom doclet is not specified with the -doclet option, the
153 javadoc command uses the default standard doclet. The javadoc command
154 has several options that are available regardless of which doclet is
155 being used. The standard doclet adds a supplementary set of command-
156 line options. See Options.
157
159 The javadoc command generates output that originates from the following
160 types of source files: Java language source files for classes (.java),
161 package comment files, overview comment files, and miscellaneous
162 unprocessed files. This section also describes test files and template
163 files that can also be in the source tree, but that you want to be sure
164 not to document.
165
166 CLASS SOURCE FILES
167 Each class or interface and its members can have their own
168 documentation comments contained in a source file. See Documentation
169 Comments.
170
171 PACKAGE COMMENT FILES
172 Each package can have its own documentation comment, contained in its
173 own source file, that the javadoc command merges into the generated
174 package summary page. You typically include in this comment any
175 documentation that applies to the entire package.
176
177 To create a package comment file, you can place your comments in one of
178 the following files:
179
180 · The package-info.java file can contain the package declaration,
181 package annotations, package comments, and Javadoc tags. This file is
182 preferred.
183
184 · The package.html file contains only package comments and Javadoc
185 tags. No package annotations.
186
187 A package can have a single package.html file or a single package-
188 info.java file, but not both. Place either file in the package
189 directory in the source tree with your source files.
190
191 The package-info.java File
192
193 The package-info.java file can contain a package comment of the
194 following structure. The comment is placed before the package
195 declaration.
196
197 Note: The comment separators /** and */ must be present, but the
198 leading asterisks on the intermediate lines can be left off.
199
200 /**
201 * Provides the classes necessary to create an
202 * applet and the classes an applet uses
203 * to communicate with its applet context.
204 * <p>
205 * The applet framework involves two entities:
206 * the applet and the applet context.
207 * An applet is an embeddable window (see the
208 * {@link java.awt.Panel} class) with a few extra
209 * methods that the applet context can use to
210 * initialize, start, and stop the applet.
211 *
212 * @since 1.0
213 * @see java.awt
214 */
215 package java.lang.applet;
216
217
218
219 The package.html File
220
221 The package.html file can contain a package comment of the following
222 structure. The comment is placed in the <body> element.
223
224 File: java/applet/package.html
225
226 <HTML>
227 <BODY>
228 Provides the classes necessary to create an applet and the
229 classes an applet uses to communicate with its applet context.
230 <p>
231 The applet framework involves two entities: the applet
232 and the applet context. An applet is an embeddable
233 window (see the {@link java.awt.Panel} class) with a
234 few extra methods that the applet context can use to
235 initialize, start, and stop the applet.
236 @since 1.0
237 @see java.awt
238 </BODY>
239 </HTML>
240
241 The package.html file is a typical HTML file and does not include a
242 package declaration. The content of the package comment file is written
243 in HTML with one exception. The documentation comment should not
244 include the comment separators /** and */ or leading asterisks. When
245 writing the comment, make the first sentence a summary about the
246 package, and do not put a title or any other text between the <body>
247 tag and the first sentence. You can include package tags. All block
248 tags must appear after the main description. If you add an @see tag in
249 a package comment file, then it must have a fully qualified name.
250
251 Processing the Comment File
252
253 When the javadoc command runs, it searches for the package comment
254 file. If the package comment file is found, then the javadoc command
255 does the following:
256
257 · Copies the comment for processing. For package.html, the javadoc
258 command copies all content between the <body> and </body> HTML tags.
259 You can include a <head> section to put a <title> tag, source file
260 copyright statement, or other information, but none of these appear
261 in the generated documentation.
262
263 · Processes the package tags. See Package Tags.
264
265 · Inserts the processed text at the bottom of the generated package
266 summary page. See Java Platform, Standard Edition API Specification
267 Overview at http://docs.oracle.com/javase/8/docs/api/overview-
268 summary.html
269
270 · Copies the first sentence of the package comment to the top of the
271 package summary page. The javadoc command also adds the package name
272 and this first sentence to the list of packages on the overview page.
273 See Java Platform, Standard Edition API Specification Overview at
274 http://docs.oracle.com/javase/8/docs/api/overview-summary.html
275
276 The end of the sentence is determined by the same rules used for the
277 end of the first sentence of class and member main descriptions.
278
279 OVERVIEW COMMENT FILES
280 Each application or set of packages that you are documenting can have
281 its own overview documentation comment that is kept in its own source
282 file, that the javadoc command merges into the generated overview page.
283 You typically include in this comment any documentation that applies to
284 the entire application or set of packages.
285
286 You can name the file anything you want such as overview.html and place
287 it anywhere. A typical location is at the top of the source tree.
288
289 For example, if the source files for the java.applet package are
290 contained in the /home/user/src/java/applet directory, then you could
291 create an overview comment file at /home/user/src/overview.html.
292
293 You can have multiple overview comment files for the same set of source
294 files in case you want to run the javadoc command multiple times on
295 different sets of packages. For example, you could run the javadoc
296 command once with -private for internal documentation and again without
297 that option for public documentation. In this case, you could describe
298 the documentation as public or internal in the first sentence of each
299 overview comment file.
300
301 The content of the overview comment file is one big documentation
302 comment that is written in HTML. Make the first sentence a summary
303 about the application or set of packages. Do not put a title or any
304 other text between the <body> tag and the first sentence. All tags
305 except inline tags, such as an {@link} tag, must appear after the main
306 description. If you add an @see tag, then it must have a fully
307 qualified name.
308
309 When you run the javadoc command, specify the overview comment file
310 name with the -overview option. The file is then processed similarly to
311 that of a package comment file. The javadoc command does the following:
312
313 · Copies all content between the <body> and </body> tags for
314 processing.
315
316 · Processes the overview tags that are present. See Overview Tags.
317
318 · Inserts the processed text at the bottom of the generated overview
319 page. See Java Platform Standard Edition API Specification Overview
320 at http://docs.oracle.com/javase/8/docs/api/overview-summary.html
321
322 · Copies the first sentence of the overview comment to the top of the
323 overview summary page.
324
325 UNPROCESSED FILES
326 Your source files can include any files that you want the javadoc
327 command to copy to the destination directory. These files usually
328 include graphic files, example Java source and class files, and self-
329 standing HTML files with a lot of content that would overwhelm the
330 documentation comment of a typical Java source file.
331
332 To include unprocessed files, put them in a directory called doc-files.
333 The doc-files directory can be a subdirectory of any package directory
334 that contains source files. You can have one doc-files subdirectory for
335 each package.
336
337 For example, if you want to include the image of a button in the
338 java.awt.Button class documentation, then place the image file in the
339 /home/user/src/java/awt/doc-files/ directory. Do not place the doc-
340 files directory at /home/user/src/java/doc-files, because java is not a
341 package. It does not contain any source files.
342
343 All links to the unprocessed files must be included in the code because
344 the javadoc command does not look at the files. The javadoc command
345 copies the directory and all of its contents to the destination. The
346 following example shows how the link in the Button.java documentation
347 comment might look:
348
349 /**
350 * This button looks like this:
351 * <img src="doc-files/Button.gif">
352 */
353
354
355 TEST AND TEMPLATE FILES
356 You can store test and template files in the source tree in the same
357 directory with or in a subdirectory of the directory where the source
358 files reside. To prevent test and template files from being processed,
359 run the javadoc command and explicitly pass in individual source file
360 names.
361
362 Test files are valid, compilable source files. Template files are not
363 valid, compatible source files, but they often have the .java suffix.
364
365 Test Files
366
367 If you want your test files to belong to either an unnamed package or
368 to a package other than the package that the source files are in, then
369 put the test files in a subdirectory underneath the source files and
370 give the directory an invalid name. If you put the test files in the
371 same directory with the source and call the javadoc command with a
372 command-line argument that indicates its package name, then the test
373 files cause warnings or errors. If the files are in a subdirectory with
374 an invalid name, then the test file directory is skipped and no errors
375 or warnings are issued. For example, to add test files for source files
376 in com.package1, put them in a subdirectory in an invalid package name.
377 The following directory name is invalid because it contains a hyphen:
378
379 com/package1/test-files/
380
381 If your test files contain documentation comments, then you can set up
382 a separate run of the javadoc command to produce test file
383 documentation by passing in their test source file names with wild
384 cards, such as com/package1/test-files/*.java.
385
386 Template Files
387
388 If you want a template file to be in the source directory, but not
389 generate errors when you execute the javadoc command, then give it an
390 invalid file name such as Buffer-Template.java to prevent it from being
391 processed. The javadoc command only processes source files with names,
392 when stripped of the .java suffix, that are valid class names.
393
395 By default, the javadoc command uses a standard doclet that generates
396 HTML-formatted documentation. The standard doclet generates basic
397 content, cross-reference, and support pages described here. Each HTML
398 page corresponds to a separate file. The javadoc command generates two
399 types of files. The first type is named after classes and interfaces.
400 The second type contain hyphens (such as package-summary.html) to
401 prevent conflicts with the first type of file.
402
403 BASIC CONTENT PAGES
404 · One class or interface page (classname.html) for each class or
405 interface being documented.
406
407 · One package page (package-summary.html) for each package being
408 documented. The javadoc command includes any HTML text provided in a
409 file with the name package.html or package-info.java in the package
410 directory of the source tree.
411
412 · One overview page (overview-summary.html) for the entire set of
413 packages. The overview page is the front page of the generated
414 document. The javadoc command includes any HTML text provided in a
415 file specified by the -overview option. The Overview page is created
416 only when you pass two or more package names into the javadoc
417 command. See HTML Frames and Options.
418
419 CROSS-REFERENCE PAGES
420 · One class hierarchy page for the entire set of packages (overview-
421 tree.html). To view the hierarchy page, click Overview in the
422 navigation bar and click Tree.
423
424 · One class hierarchy page for each package (package-tree.html) To view
425 the hierarchy page, go to a particular package, class, or interface
426 page, and click Tree to display the hierarchy for that package.
427
428 · One use page for each package (package-use.html) and a separate use
429 page for each class and interface (class-use/classname.html). The use
430 page describes what packages, classes, methods, constructors and
431 fields use any part of the specified class, interface, or package.
432 For example, given a class or interface A, its use page includes
433 subclasses of A, fields declared as A, methods that return A, and
434 methods and constructors with parameters of type A. To view the use
435 page, go to the package, class, or interface and click the Use link
436 in the navigation bar.
437
438 · A deprecated API page (deprecated-list.html) that lists all
439 deprecated APIs and their suggested replacements. Avoid deprecated
440 APIs because they can be removed in future implementations.
441
442 · A constant field values page (constant-values.html) for the values of
443 static fields.
444
445 · A serialized form page (serialized-form.html) that provides
446 information about serializable and externalizable classes with field
447 and method descriptions. The information on this page is of interest
448 to reimplementors, and not to developers who want to use the API. To
449 access the serialized form page, go to any serialized class and click
450 Serialized Form in the See Also section of the class comment. The
451 standard doclet generates a serialized form page that lists any class
452 (public or non-public) that implements Serializable with its
453 readObject and writeObject methods, the fields that are serialized,
454 and the documentation comments from the @serial, @serialField, and
455 @serialData tags. Public serializable classes can be excluded by
456 marking them (or their package) with @serial exclude, and package-
457 private serializable classes can be included by marking them (or
458 their package) with an @serial include. As of Release 1.4, you can
459 generate the complete serialized form for public and private classes
460 by running the javadoc command without specifying the -private
461 option. See Options.
462
463 · An index page (index-*.html) of all class, interface, constructor,
464 field and method names, in alphabetical order. The index page is
465 internationalized for Unicode and can be generated as a single file
466 or as a separate file for each starting character (such as A–Z for
467 English).
468
469 SUPPORT PAGES
470 · A help page (help-doc.html) that describes the navigation bar and the
471 previous pages. Use -helpfile to override the default help file with
472 your own custom help file.
473
474 · One index.html file that creates the HTML frames for display. Load
475 this file to display the front page with frames. The index.html file
476 contains no text content.
477
478 · Several frame files (*-frame.html) that contains lists of packages,
479 classes, and interfaces. The frame files display the HTML frames.
480
481 · A package list file (package-list) that is used by the -link and
482 -linkoffline options. The package list file is a text file that is
483 not reachable through links.
484
485 · A style sheet file (stylesheet.css) that controls a limited amount of
486 color, font family, font size, font style, and positioning
487 information on the generated pages.
488
489 · A doc-files directory that holds image, example, source code, or
490 other files that you want copied to the destination directory. These
491 files are not processed by the javadoc command. This directory is not
492 processed unless it exists in the source tree.
493
494 See Options.
495
496 HTML FRAMES
497 The javadoc command generates the minimum number of frames (two or
498 three) necessary based on the values passed to the command. It omits
499 the list of packages when you pass a single package name or source
500 files that belong to a single package as an argument to the javadoc
501 command. Instead, the javadoc command creates one frame in the left-
502 hand column that displays the list of classes. When you pass two or
503 more package names, the javadoc command creates a third frame that
504 lists all packages and an overview page (overview-summary.html). To
505 bypass frames, click the No Frames link or enter the page set from the
506 overview-summary.html page.
507
508 GENERATED FILE STRUCTURE
509 The generated class and interface files are organized in the same
510 directory hierarchy that Java source files and class files are
511 organized. This structure is one directory per subpackage.
512
513 For example, the document generated for the java.applet.Applet class
514 would be located at java/applet/Applet.html.
515
516 The file structure for the java.applet package follows, assuming that
517 the destination directory is named apidocs. All files that contain the
518 word frame appear in the upper-left or lower-left frames, as noted. All
519 other HTML files appear in the right-hand frame.
520
521 Directories are bold. The asterisks (*) indicate the files and
522 directories that are omitted when the arguments to the javadoc command
523 are source file names rather than package names. When arguments are
524 source file names, an empty package list is created. The doc-files
525 directory is not created in the destination unless it exists in the
526 source tree. See Generated Files.
527
528 · apidocs: Top-level directory
529
530 · index.html: Initial Page that sets up HTML frames
531
532 · *overview-summary.html: Package list with summaries
533
534 · overview-tree.html: Class hierarchy for all packages
535
536 · deprecated-list.html: Deprecated APIs for all packages
537
538 · constant-values.html: Static field values for all packages
539
540 · serialized-form.html: Serialized forms for all packages
541
542 · *overview-frame.html: All packages for display in upper-left frame
543
544 · allclasses-frame.html: All classes for display in lower-left frame
545
546 · help-doc.html: Help about Javadoc page organization
547
548 · index-all.html: Default index created without -splitindex option
549
550 · index-files: Directory created with -splitindex option
551
552 · index-<number>.html: Index files created with -splitindex option
553
554
555 · package-list: Package names for resolving external references
556
557 · stylesheet.css: Defines fonts, colors, positions, and so on
558
559
560 · java: Package directory
561
562 · applet: Subpackage directory
563
564 · Applet.html: Applet class page
565
566 · AppletContext.html: AppletContext interface
567
568 · AppletStub.html: AppletStub interface
569
570 · AudioClip.html: AudioClip interface
571
572 · package-summary.html: Classes with summaries
573
574 · package-frame.html: Package classes for display in lower-left
575 frame
576
577 · package-tree.html: Class hierarchy for this package
578
579 · package-use.html: Where this package is used
580
581 · doc-files: Image and example files directory
582
583 · class-use: Image and examples file location
584
585 - Applet.html: Uses of the Applet class
586
587 - AppletContext.html: Uses of the AppletContext interface
588
589 - AppletStub.html: Uses of the AppletStub interface
590
591 - AudioClip.html: Uses of the AudioClip interface
592
593
594
595 · src-html: Source code directory
596
597 · java: Package directory
598
599 · applet: Subpackage directory
600
601 - Applet.html: Applet source code
602
603 - AppletContext.html: AppletContext source code
604
605 - AppletStub.html: AppletStub source code
606
607 - AudioClip.html: AudioClip source code
608
609
610
611 GENERATED API DECLARATIONS
612 The javadoc command generates a declaration at the start of each class,
613 interface, field, constructor, and method description for that API
614 item. For example, the declaration for the Boolean class is:
615
616 public final class Boolean
617 extends Object
618 implements Serializable
619
620 The declaration for the Boolean.valueOf method is:
621
622 public static Boolean valueOf(String s)
623
624 The javadoc command can include the modifiers public, protected,
625 private, abstract, final, static, transient, and volatile, but not
626 synchronized or native. The synchronized and native modifiers are
627 considered implementation detail and not part of the API specification.
628
629 Rather than relying on the keyword synchronized, APIs should document
630 their concurrency semantics in the main description of the comment. For
631 example, a description might be: A single enumeration cannot be used by
632 multiple threads concurrently. The document should not describe how to
633 achieve these semantics. As another example, while the Hashtable option
634 should be thread-safe, there is no reason to specify that it is
635 achieved by synchronizing all of its exported methods. It is better to
636 reserve the right to synchronize internally at the bucket level for
637 higher concurrency.
638
640 This section describes source code comments and comment inheritance.
641
642 SOURCE CODE COMMENTS
643 You can include documentation comments in the source code, ahead of
644 declarations for any class, interface, method, constructor, or field.
645 You can also create documentation comments for each package and another
646 one for the overview, though their syntax is slightly different. A
647 documentation comment consists of the characters between /** and */
648 that end it. Leading asterisks are allowed on each line and are
649 described further in the following section. The text in a comment can
650 continue onto multiple lines.
651
652 /**
653 * This is the typical format of a simple documentation comment
654 * that spans two lines.
655 */
656
657 To save space you can put a comment on one line:
658
659 /** This comment takes up only one line. */
660
661
662
663 Placement of Comments
664
665 Documentation comments are recognized only when placed immediately
666 before class, interface, constructor, method, or field declarations.
667 Documentation comments placed in the body of a method are ignored. The
668 javadoc command recognizes only one documentation comment per
669 declaration statement. See Where Tags Can Be Used.
670
671 A common mistake is to put an import statement between the class
672 comment and the class declaration. Do not put an import statement at
673 this location because the javadoc command ignores the class comment.
674
675 /**
676 * This is the class comment for the class Whatever.
677 */
678 import com.example; // MISTAKE - Important not to put import statement here
679 public class Whatever{ }
680
681
682
683 Parts of Comments
684
685 A documentation comment has a main description followed by a tag
686 section. The main description begins after the starting delimiter /**
687 and continues until the tag section. The tag section starts with the
688 first block tag, which is defined by the first @ character that begins
689 a line (ignoring leading asterisks, white space, and leading separator
690 /**). It is possible to have a comment with only a tag section and no
691 main description. The main description cannot continue after the tag
692 section begins. The argument to a tag can span multiple lines. There
693 can be any number of tags, and some types of tags can be repeated while
694 others cannot. For example, this @see tag starts the tag section:
695
696 /**
697 * This sentence holds the main description for this documentation comment.
698 * @see java.lang.Object
699 */
700
701
702
703 Block and inline Tags
704
705 A tag is a special keyword within a documentation comment that the
706 javadoc command processes. There are two kinds of tags: block tags,
707 which appear as an @tag tag (also known as standalone tags), and inline
708 tags, which appear within braces, as an {@tag} tag. To be interpreted,
709 a block tag must appear at the beginning of a line, ignoring leading
710 asterisks, white space, and the separator (/**). This means you can use
711 the @ character elsewhere in the text and it will not be interpreted as
712 the start of a tag. If you want to start a line with the @ character
713 and not have it be interpreted, then use the HTML entity @. Each
714 block tag has associated text, which includes any text following the
715 tag up to, but not including, either the next tag, or the end of the
716 documentation comment. This associated text can span multiple lines. An
717 inline tag is allowed and interpreted anywhere that text is allowed.
718 The following example contains the @deprecated block tag and the
719 {@link} inline tag. See Javadoc Tags.
720
721 /**
722 * @deprecated As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}
723 */
724
725
726
727 Write Comments in HTML
728
729 The text must be written in HTML with HTML entities and HTML tags. You
730 can use whichever version of HTML your browser supports. The standard
731 doclet generates HTML 3.2-compliant code elsewhere (outside of the
732 documentation comments) with the inclusion of cascading style sheets
733 and frames. HTML 4.0 is preferred for generated files because of the
734 frame sets.
735
736 For example, entities for the less than symbol (<) and the greater than
737 symbol (>) should be written as < and >. Similarly, the ampersand
738 (&) should be written as &. The bold HTML tag <b> is shown in the
739 following example.
740
741 /**
742 * This is a <b>doc</b> comment.
743 * @see java.lang.Object
744 */
745
746
747
748 Leading Asterisks
749
750 When the javadoc command parses a documentation comment, leading
751 asterisks (*) on each line are discarded, and blanks and tabs that
752 precede the initial asterisks (*) are also discarded. If you omit the
753 leading asterisk on a line, then the leading white space is no longer
754 removed so that you can paste code examples directly into a
755 documentation comment inside a <PRE> tag with its indentation
756 preserved. Spaces are interpreted by browsers more uniformly than tabs.
757 Indentation is relative to the left margin (rather than the separator
758 /** or <PRE> tag).
759
760 First Sentence
761
762 The first sentence of each documentation comment should be a summary
763 sentence that contains a concise but complete description of the
764 declared entity. This sentence ends at the first period that is
765 followed by a blank, tab, or line terminator, or at the first block
766 tag. The javadoc command copies this first sentence to the member
767 summary at the top of the HTML page.
768
769 Multiple-Field Declarations
770
771 The Java platform lets you declare multiple fields in a single
772 statement, but this statement can have only one documentation comment
773 that is copied for all fields. If you want individual documentation
774 comments for each field, then declare each field in a separate
775 statement. For example, the following documentation comment does not
776 make sense written as a single declaration and would be better handled
777 as two declarations:
778
779 /**
780 * The horizontal and vertical distances of point (x,y)
781 */
782 public int x, y; // Avoid this
783
784 The javadoc command generates the following documentation from the
785 previous code:
786
787 public int x
788
789 The horizontal and vertical distances of point (x, y).
790
791 public int y
792
793 The horizontal and vertical distances of point (x, y).
794
795 Use of Header Tags
796
797 When writing documentation comments for members, it is best not to use
798 HTML heading tags such as <H1> and <H2>, because the javadoc command
799 creates an entire structured document, and these structural tags might
800 interfere with the formatting of the generated document. However, you
801 can use these headings in class and package comments to provide your
802 own structure.
803
804 METHOD COMMENT INHERITANCE
805 The javadoc command allows method comment inheritance in classes and
806 interfaces to fill in missing text or to explicitly inherit method
807 comments. Constructors, fields, and nested classes do not inherit
808 documentation comments.
809
810 Note: The source file for an inherited method must be on the path
811 specified by the -sourcepath option for the documentation comment to be
812 available to copy. Neither the class nor its package needs to be passed
813 in on the command line. This contrasts with Release 1.3.n and earlier
814 releases, where the class had to be a documented class.
815
816 Fill in Missing Text
817
818 When a main description, or @return, @param, or @throws tag is missing
819 from a method comment, the javadoc command copies the corresponding
820 main description or tag comment from the method it overrides or
821 implements (if any). See Method Comment Inheritance.
822
823 When an @param tag for a particular parameter is missing, the comment
824 for that parameter is copied from the method further up the inheritance
825 hierarchy. When an @throws tag for a particular exception is missing,
826 the @throws tag is copied only when that exception is declared.
827
828 This behavior contrasts with Release 1.3 and earlier, where the
829 presence of any main description or tag would prevent all comments from
830 being inherited.
831
832 See Javadoc Tags and Options.
833
834 Explicit Inheritance
835
836 Insert the {@inheritDoc} inline tag in a method main description or
837 @return, @param, or @throws tag comment. The corresponding inherited
838 main description or tag comment is copied into that spot.
839
840 CLASS AND INTERFACE INHERITANCE
841 Comment inheritance occurs in all possible cases of inheritance from
842 classes and interfaces:
843
844 · When a method in a class overrides a method in a superclass
845
846 · When a method in an interface overrides a method in a superinterface
847
848 · When a method in a class implements a method in an interface
849
850 In the first two cases, the javadoc command generates the subheading
851 Overrides in the documentation for the overriding method. A link to the
852 method being overridden is included, whether or not the comment is
853 inherited.
854
855 In the third case, when a method in a specified class implements a
856 method in an interface, the javadoc command generates the subheading
857 Specified by in the documentation for the overriding method. A link to
858 the method being implemented is included, whether or not the comment is
859 inherited.
860
861 METHOD COMMENTS ALGORITHM
862 If a method does not have a documentation comment, or has an
863 {@inheritDoc} tag, then the javadoc command uses the following
864 algorithm to search for an applicable comment. The algorithm is
865 designed to find the most specific applicable documentation comment,
866 and to give preference to interfaces over superclasses:
867
868 1. Look in each directly implemented (or extended) interface in the
869 order they appear following the word implements (or extends) in the
870 method declaration. Use the first documentation comment found for
871 this method.
872
873 2. If Step 1 failed to find a documentation comment, then recursively
874 apply this entire algorithm to each directly implemented (or
875 extended) interface in the same order they were examined in Step 1.
876
877 3. When Step 2 fails to find a documentation comment and this is a
878 class other than the Object class, but not an interface:
879
880 1. If the superclass has a documentation comment for this method,
881 then use it.
882
883 2. If Step 3a failed to find a documentation comment, then
884 recursively apply this entire algorithm to the superclass.
885
886
888 The javadoc command parses special tags when they are embedded within a
889 Java documentation comment. The javadoc tags let you autogenerate a
890 complete, well-formatted API from your source code. The tags start with
891 an at sign (@) and are case-sensitive. They must be typed with the
892 uppercase and lowercase letters as shown. A tag must start at the
893 beginning of a line (after any leading spaces and an optional
894 asterisk), or it is treated as text. By convention, tags with the same
895 name are grouped together. For example, put all @see tags together. For
896 more information, see Where Tags Can Be Used.
897
898 Tags have the following types:
899
900 · Bock tags: Place block tags only in the tag section that follows the
901 description. Block tags have the form: @tag.
902
903 · Inline tags: Place inline tags anywhere in the main description or in
904 the comments for block tags. Inline tags are enclosed within braces:
905 {@tag}.
906
907 For custom tags, see -tag tagname:Xaoptcmf:"taghead". See also Where
908 Tags Can Be Used.
909
910 TAG DESCRIPTIONS
911 @author name-text
912 Introduced in JDK 1.0
913
914 Adds an Author entry with the specified name text to the
915 generated documents when the -author option is used. A
916 documentation comment can contain multiple @author tags. You can
917 specify one name per @author tag or multiple names per tag. In
918 the former case, the javadoc command inserts a comma (,) and
919 space between names. In the latter case, the entire text is
920 copied to the generated document without being parsed.
921 Therefore, you can use multiple names per line if you want a
922 localized name separator other than a comma. See @author in How
923 to Write Doc Comments for the Javadoc Tool at
924 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@author
925
926 {@code text}
927 Introduced in JDK 1.5
928
929 Equivalent to <code>{@literal}</code>.
930
931 Displays text in code font without interpreting the text as HTML
932 markup or nested Javadoc tags. This enables you to use regular
933 angle brackets (< and >) instead of the HTML entities (< and
934 >) in documentation comments, such as in parameter types
935 (<Object>), inequalities (3 < 4), or arrows (<-). For example,
936 the documentation comment text {@code A<B>C} displayed in the
937 generated HTML page unchanged as A<B>C. This means that the <B>
938 is not interpreted as bold and is in code font. If you want the
939 same functionality without the code font, then use the
940 {@literal} tag.
941
942 @deprecated deprecated-text
943 Introduced in JDK 1.0
944
945 Adds a comment indicating that this API should no longer be used
946 (even though it may continue to work). The javadoc command moves
947 deprecated-textahead of the main description, placing it in
948 italics and preceding it with a bold warning: Deprecated. This
949 tag is valid in all documentation comments: overview, package,
950 class, interface, constructor, method and field.
951
952 The first sentence of deprecated text should tell the user when
953 the API was deprecated and what to use as a replacement. The
954 javadoc command copies the first sentence to the summary section
955 and index. Subsequent sentences can also explain why it was
956 deprecated. You should include an {@link} tag (for Javadoc 1.2
957 or later) that points to the replacement API.
958
959 Use the @deprecated annotation tag to deprecate a program
960 element. See How and When to Deprecate APIs at
961 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/deprecation/deprecation.html
962
963 See also @deprecated in How to Write Doc Comments for the
964 Javadoc Tool at
965 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@deprecated
966
967 {@docRoot}
968 Introduced in JDK 1.3
969
970 Represents the relative path to the generated document's
971 (destination) root directory from any generated page. This tag
972 is useful when you want to include a file, such as a copyright
973 page or company logo, that you want to reference from all
974 generated pages. Linking to the copyright page from the bottom
975 of each page is common.
976
977 This {@docRoot} tag can be used both on the command line and in
978 a documentation comment. This tag is valid in all documentation
979 comments: overview, package, class, interface, constructor,
980 method and field, and includes the text portion of any tag (such
981 as the @return, @param and @deprecated tags).
982
983 · On the command line, where the header, footer, or bottom are
984 defined: javadoc -bottom '<a
985 href="{@docRoot}/copyright.html">Copyright</a>'.
986
987 When you use the {@docRoot} tag this way in a make file, some
988 makefile programs require a special way to escape for the
989 brace {} characters. For example, the Inprise MAKE version 5.2
990 running on Windows requires double braces: {{@docRoot}}. It
991 also requires double (rather than single) quotation marks to
992 enclose arguments to options such as the -bottom option (with
993 the quotation marks around the href argument omitted).
994
995 · In a documentation comment:
996
997 /**
998 * See the <a href="{@docRoot}/copyright.html">Copyright</a>.
999 */
1000
1001
1002
1003 This tag is needed because the generated documents are in
1004 hierarchical directories, as deep as the number of
1005 subpackages. The expression: <a
1006 href="{@docRoot}/copyright.html"> resolves to <a
1007 href="../../copyright.html"> for java/lang/Object.java and <a
1008 href="../../../copyright.html"> for
1009 java/lang/ref/Reference.java.
1010
1011
1012 @exception class-name description
1013 Introduced in JDK 1.0
1014
1015 Identical to the @throws tag. See @throws class-name
1016 description.
1017
1018 {@inheritDoc}
1019 Introduced in JDK 1.4
1020
1021 Inherits (copies) documentation from the nearest inheritable
1022 class or implementable interface into the current documentation
1023 comment at this tag's location. This enables you to write more
1024 general comments higher up the inheritance tree and to write
1025 around the copied text.
1026
1027 This tag is valid only in these places in a documentation
1028 comment:
1029
1030 · In the main description block of a method. In this case, the
1031 main description is copied from a class or interface up the
1032 hierarchy.
1033
1034 · In the text arguments of the @return, @param, and @throws tags
1035 of a method. In this case, the tag text is copied from the
1036 corresponding tag up the hierarchy.
1037
1038
1039 See Method Comment Inheritance for a description of how comments are
1040 found in the inheritance hierarchy. Note that if this tag is missing,
1041 then the comment is or is not automatically inherited according to
1042 rules described in that section.
1043
1044 {@link package.class#member label}
1045 Introduced in JDK 1.2
1046
1047 Inserts an inline link with a visible text label that points to
1048 the documentation for the specified package, class, or member
1049 name of a referenced class. This tag is valid in all
1050 documentation comments: overview, package, class, interface,
1051 constructor, method and field, including the text portion of any
1052 tag, such as the @return, @param and @deprecated tags. See @link
1053 in How to Write Doc Comments for the Javadoc Tool at
1054 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#{@link
1055
1056 This tag is similar to the @see tag. Both tags require the same
1057 references and accept the same syntax for package.class#member
1058 and label. The main difference is that the {@link} tag generates
1059 an inline link rather than placing the link in the See Also
1060 section. The {@link} tag begins and ends with braces to separate
1061 it from the rest of the inline text. If you need to use the
1062 right brace (}) inside the label, then use the HTML entity
1063 notation }.
1064
1065 There is no limit to the number of {@link} tags allowed in a
1066 sentence. You can use this tag in the main description part of
1067 any documentation comment or in the text portion of any tag,
1068 such as the @deprecated, @return or @param tags.
1069
1070 For example, here is a comment that refers to the
1071 getComponentAt(int, int) method:
1072
1073 Use the {@link #getComponentAt(int, int) getComponentAt} method.
1074
1075
1076
1077 From this code, the standard doclet generates the following HTML
1078 (assuming it refers to another class in the same package):
1079
1080 Use the <a href="Component.html#getComponentAt(int, int)">getComponentAt</a> method.
1081
1082
1083
1084 The previous line appears on the web page as:
1085
1086 Use the getComponentAt method.
1087
1088
1089
1090 {@linkplain package.class#member label}
1091 Introduced in JDK 1.4
1092
1093 Behaves the same as the {@link} tag, except the link label is
1094 displayed in plain text rather than code font. Useful when the
1095 label is plain text. For example, Refer to {@linkplain add() the
1096 overridden method}. displays as: Refer to the overridden method.
1097
1098 {@literal text}
1099 Introduced in JDK 1.5
1100
1101 Displays text without interpreting the text as HTML markup or
1102 nested Javadoc tags. This enables you to use angle brackets (<
1103 and >) instead of the HTML entities (< and >) in
1104 documentation comments, such as in parameter types (<Object>),
1105 inequalities (3 < 4), or arrows (<-). For example, the
1106 documentation comment text {@literal A<B>C} displays unchanged
1107 in the generated HTML page in your browser, as A<B>C. The <B> is
1108 not interpreted as bold (and it is not in code font). If you
1109 want the same functionality with the text in code font, then use
1110 the {@code} tag.
1111
1112 @param parameter-name description
1113 Introduced in JDK 1.0
1114
1115 Adds a parameter with the specified parameter-name followed by
1116 the specified description to the Parameters section. When
1117 writing the documentation comment, you can continue the
1118 description onto multiple lines. This tag is valid only in a
1119 documentation comment for a method, constructor, or class. See
1120 @param in How to Write Doc Comments for the Javadoc Tool at
1121 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@param
1122
1123 The parameter-name can be the name of a parameter in a method or
1124 constructor, or the name of a type parameter of a class, method,
1125 or constructor. Use angle brackets around this parameter name to
1126 specify the use of a type parameter.
1127
1128 Example of a type parameter of a class:
1129
1130 /**
1131 * @param <E> Type of element stored in a list
1132 */
1133 public interface List<E> extends Collection<E> {
1134 }
1135
1136
1137
1138 Example of a type parameter of a method:
1139
1140 /**
1141 * @param string the string to be converted
1142 * @param type the type to convert the string to
1143 * @param <T> the type of the element
1144 * @param <V> the value of the element
1145 */
1146 <T, V extends T> V convert(String string, Class<T> type) {
1147 }
1148
1149
1150
1151 @return description
1152 Introduced in JDK 1.0
1153
1154 Adds a Returns section with the description text. This text
1155 should describe the return type and permissible range of values.
1156 This tag is valid only in a documentation comment for a method.
1157 See @return in How to Write Doc Comments for the Javadoc Tool at
1158 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@return
1159
1160 @see reference
1161 Introduced in JDK 1.0
1162
1163 Adds a See Also heading with a link or text entry that points to
1164 a reference. A documentation comment can contain any number of
1165 @see tags, which are all grouped under the same heading. The
1166 @see tag has three variations. The form is the most common. This
1167 tag is valid in any documentation comment: overview, package,
1168 class, interface, constructor, method, or field. For inserting
1169 an inline link within a sentence to a package, class, or member,
1170 see {@link}.
1171
1172 Form 1. The @see string tag form adds a text entry for string.
1173 No link is generated. The string is a book or other reference to
1174 information not available by URL. The javadoc command
1175 distinguishes this from the previous cases by searching for a
1176 double quotation mark (") as the first character. For example,
1177 @see "The Java Programming Language" that generates the
1178 following text:
1179
1180 See Also:
1181
1182 "The Java Programming Language"
1183
1184 Form 2. The @see <a href="URL#value">label</a> form adds a link
1185 as defined by URL#value. The URL#value parameter is a relative
1186 or absolute URL. The javadoc command distinguishes this from
1187 other cases by searching for a less-than symbol (<) as the first
1188 character. For example, @see <a href="spec.html#section">Java
1189 Spec</a> generates the following link:
1190
1191 See Also:
1192
1193 Java Spec
1194
1195 Form 3. The @see package.class#member label form adds a link
1196 with a visible text label that points to the documentation for
1197 the specified name in the Java Language that is referenced. The
1198 label is optional. If the label is omitted, then the name
1199 appears instead as visible text, suitably shortened. Use the
1200 -noqualifier option to globally remove the package name from
1201 this visible text. Use the label when you want the visible text
1202 to be different from the autogenerated visible text. See How a
1203 Name Appears.
1204
1205 In Java SE 1.2 only, the name but not the label automatically
1206 appears in <code> HTML tags. Starting with Java SE 1.2.2, the
1207 <code> tag is always included around the visible text, whether
1208 or not a label is used.
1209
1210 · package.class#member is any valid program element name that is
1211 referenced, such as a package, class, interface, constructor,
1212 method or field name, except that the character ahead of the
1213 member name should be a number sign (#). The class represents
1214 any top-level or nested class or interface. The member
1215 represents any constructor, method, or field (not a nested
1216 class or interface). If this name is in the documented
1217 classes, then the javadoc command create a link to it. To
1218 create links to external referenced classes, use the -link
1219 option. Use either of the other two @see tag forms to refer to
1220 the documentation of a name that does not belong to a
1221 referenced class. See Specify a Name.
1222
1223 Note: External referenced classes are classes that are not
1224 passed into the javadoc command on the command line. Links in
1225 the generated documentation to external referenced classes are
1226 called external references or external links. For example, if
1227 you run the javadoc command on only the java.awt package, then
1228 any class in java.lang, such as Object, is an external
1229 referenced class. Use the -link and -linkoffline options to
1230 link to external referenced classes. The source comments of
1231 external referenced classes are not available to the javadoc
1232 command run.
1233
1234 · label is optional text that is visible as the link label. The
1235 label can contain white space. If label is omitted, then
1236 package.class.member appears, suitably shortened relative to
1237 the current class and package. See How a Name Appears.
1238
1239 · A space is the delimiter between package.class#member and
1240 label. A space inside parentheses does not indicate the start
1241 of a label, so spaces can be used between parameters in a
1242 method.
1243
1244
1245 In the following example, an @see tag (in the Character class) refers
1246 to the equals method in the String class. The tag includes both
1247 arguments: the name String#equals(Object) and the label equals.
1248
1249 /**
1250 * @see String#equals(Object) equals
1251 */
1252
1253
1254
1255 The standard doclet produces HTML that is similar to:
1256
1257 <dl>
1258 <dt><b>See Also:</b>
1259 <dd><a href="../../java/lang/String#equals(java.lang.Object)"><code>equals<code></a>
1260 </dl>
1261
1262
1263
1264 The previous code looks similar to the following in a browser, where
1265 the label is the visible link text:
1266
1267 See Also:
1268
1269 equals
1270
1271 Specify a Name
1272
1273 This package.class#member name can be either fully qualified, such as
1274 java.lang.String#toUpperCase() or not, such as String#toUpperCase() or
1275 #toUpperCase(). If the name is less than fully qualified, then the
1276 javadoc command uses the standard Java compiler search order to find
1277 it. See Search Order for the @see Tag. The name can contain white space
1278 within parentheses, such as between method arguments.The advantage to
1279 providing shorter, partially qualified names is that they are shorter
1280 to type and there is less clutter in the source code. The following
1281 listing shows the different forms of the name, where Class can be a
1282 class or interface; Type can be a class, interface, array, or
1283 primitive; and method can be a method or constructor.
1284
1285 Typical forms for @see package.class#member
1286 Referencing a member of the current class
1287 @see #field
1288 @see #method(Type, Type,...)
1289 @see #method(Type argname, Type argname,...)
1290 @see #constructor(Type, Type,...)
1291 @see #constructor(Type argname, Type argname,...)
1292 Referencing another class in the current or imported packages
1293 @see Class#field
1294 @see Class#method(Type, Type,...)
1295 @see Class#method(Type argname, Type argname,...)
1296 @see Class#constructor(Type, Type,...)
1297 @see Class#constructor(Type argname, Type argname,...)
1298 @see Class.NestedClass
1299 @see Class
1300 Referencing an element in another package (fully qualified)
1301 @see package.Class#field
1302 @see package.Class#method(Type, Type,...)
1303 @see package.Class#method(Type argname, Type argname,...)
1304 @see package.Class#constructor(Type, Type,...)
1305 @see package.Class#constructor(Type argname, Type argname,...)
1306 @see package.Class.NestedClass
1307 @see package.Class
1308 @see package
1309
1310 Notes about the previous listing:
1311
1312 · The first set of forms with no class or package causes the javadoc
1313 command to search only through the current class hierarchy. It finds
1314 a member of the current class or interface, one of its superclasses
1315 or superinterfaces, or one of its enclosing classes or interfaces
1316 (search Items 1–3). It does not search the rest of the current
1317 package or other packages (search Items 4–5). See Search Order for
1318 the @see Tag.
1319
1320 · If any method or constructor is entered as a name with no
1321 parentheses, such as getValue, and if there is no field with the same
1322 name, then the javadoc command still creates a link to the method. If
1323 this method is overloaded, then the javadoc command links to the
1324 first method its search encounters, which is unspecified.
1325
1326 · Nested classes must be specified as outer.inner, not simply inner,
1327 for all forms.
1328
1329 · As stated, the number sign (#), rather than a dot (.) separates a
1330 member from its class. This enables the javadoc command to resolve
1331 ambiguities, because the dot also separates classes, nested classes,
1332 packages, and subpackages. However, the javadoc command properly
1333 parses a dot when there is no ambiguity, but prints a warning to
1334 alert you.
1335
1336 Search Order for the @see Tag
1337
1338 The javadoc command processes an @see tag that appears in a source
1339 file, package file, or overview file. In the latter two files, you must
1340 fully qualify the name you supply with the @see tag. In a source file,
1341 you can specify a name that is fully qualified or partially qualified.
1342
1343 The following is the search order for the @see tag.
1344
1345 1. The current class or interface.
1346
1347 2. Any enclosing classes and interfaces searching the closest first.
1348
1349 3. Any superclasses and superinterfaces, searching the closest first.
1350
1351 4. The current package.
1352
1353 5. Any imported packages, classes, and interfaces, searching in the
1354 order of the import statement.
1355
1356 The javadoc command continues to search recursively through Items 1-3
1357 for each class it encounters until it finds a match. That is, after it
1358 searches through the current class and its enclosing class E, it
1359 searches through the superclasses of E before the enclosing classes of
1360 E. In Items 4 and 5, the javadoc command does not search classes or
1361 interfaces within a package in any specified order (that order depends
1362 on the particular compiler). In Item 5, the javadoc command searches in
1363 java.lang because that is imported by all programs.
1364
1365 When the javadoc command encounters an @see tag in a source file that
1366 is not fully qualified, it searches for the specified name in the same
1367 order as the Java compiler would, except the javadoc command does not
1368 detect certain name space ambiguities because it assumes the source
1369 code is free of these errors. This search order is formally defined in
1370 the Java Language Specification. The javadoc command searches for that
1371 name through all related and imported classes and packages. In
1372 particular, it searches in this order:
1373
1374 1. The current class or interface.
1375
1376 2. Any enclosing classes and interfaces, searching the closest first.
1377
1378 3. Any superclasses and superinterfaces, searching the closest first.
1379
1380 4. The current package.
1381
1382 5. Any imported packages, classes, and interfaces, searching in the
1383 order of the import statements.
1384
1385 The javadoc command does not necessarily look in subclasses, nor will
1386 it look in other packages even when their documentation is being
1387 generated in the same run. For example, if the @see tag is in the
1388 java.awt.event.KeyEvent class and refers to a name in the java.awt
1389 package, then the javadoc command does not look in that package unless
1390 that class imports it.
1391
1392 How a Name Appears
1393
1394 If label is omitted, then package.class.member appears. In general, it
1395 is suitably shortened relative to the current class and package.
1396 Shortened means the javadoc command displays only the minimum name
1397 necessary. For example, if the String.toUpperCase() method contains
1398 references to a member of the same class and to a member of a different
1399 class, then the class name is displayed only in the latter case, as
1400 shown in the following listing. Use the -noqualifier option to globally
1401 remove the package names.
1402
1403 Type of reference: The @see tag refers to a member of the same class,
1404 same package
1405 Example in: @see String#toLowerCase()
1406 Appears as: toLowerCase() - omits the package and class names
1407
1408
1409 Type of reference: The @see tag refers to a member of a different
1410 class, same package
1411 Example in: @see Character#toLowerCase(char)
1412 Appears as: Character.toLowerCase(char) - omits the package name,
1413 includes the class name
1414
1415
1416 Type of reference: The @see tag refers to a member of a different
1417 class, different package
1418 Example in: @see java.io.File#exists()
1419 Appears as: java.io.File.exists() - includes the package and class
1420 names
1421
1422
1423 Examples of the @see Tag
1424
1425 The comment to the right shows how the name appears when the @see tag
1426 is in a class in another package, such as java.applet.Applet. See @see
1427 in How to Write Doc Comments for the Javadoc Tool at
1428 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@see
1429
1430 See also:
1431 @see java.lang.String // String
1432 @see java.lang.String The String class // The String class
1433 @see String // String
1434 @see String#equals(Object) // String.equals(Object)
1435 @see String#equals // String.equals(java.lang.Object)
1436 @see java.lang.Object#wait(long) // java.lang.Object.wait(long)
1437 @see Character#MAX_RADIX // Character.MAX_RADIX
1438 @see <a href="spec.html">Java Spec</a> // Java Spec
1439 @see "The Java Programming Language" // "The Java Programming Language"
1440
1441 Note: You can extend the @see tag to link to classes not being
1442 documented with the -link option.
1443
1444 @serial field-description | include | exclude
1445 Introduced in JDK 1.2
1446
1447 Used in the documentation comment for a default serializable
1448 field. See Documenting Serializable Fields and Data for a Class
1449 at
1450 http://docs.oracle.com/javase/8/docs/platform/serialization/spec/serial-
1451 arch.html#5251
1452
1453 See also Oracle’s Criteria for Including Classes in the
1454 Serialized Form Specification at
1455 http://www.oracle.com/technetwork/java/javase/documentation/serialized-
1456 criteria-137781.html
1457
1458 An optional field-description should explain the meaning of the
1459 field and list the acceptable values. When needed, the
1460 description can span multiple lines. The standard doclet adds
1461 this information to the serialized form page. See Cross-
1462 Reference Pages.
1463
1464 If a serializable field was added to a class after the class was
1465 made serializable, then a statement should be added to its main
1466 description to identify at which version it was added.
1467
1468 The include and exclude arguments identify whether a class or
1469 package should be included or excluded from the serialized form
1470 page. They work as follows:
1471
1472 · A public or protected class that implements Serializable is
1473 included unless that class (or its package) is marked with the
1474 @serial exclude tag.
1475
1476 · A private or package-private class that implements
1477 Serializable is excluded unless that class (or its package) is
1478 marked with the @serial include tag.
1479
1480
1481 For example, the javax.swing package is marked with the @serialexclude
1482 tag in package.html or package-info.java. The public class
1483 java.security.BasicPermission is marked with the @serial exclude tag.
1484 The package-private class java.util.PropertyPermissionCollection is
1485 marked with the @serial include tag.
1486
1487 The @serial tag at the class level overrides the @serial tag at the
1488 package level.
1489
1490 @serialData data-description
1491 Introduced in JDK 1.2
1492
1493 Uses the data description value to document the types and order
1494 of data in the serialized form. This data includes the optional
1495 data written by the writeObject method and all data (including
1496 base classes) written by the Externalizable.writeExternal
1497 method.
1498
1499 The @serialData tag can be used in the documentation comment for
1500 the writeObject, readObject, writeExternal, readExternal,
1501 writeReplace, and readResolve methods.
1502
1503 @serialField field-namefield-typefield-description
1504 Introduced in JDK 1.2
1505
1506 Documents an ObjectStreamField component of the
1507 serialPersistentFields member of a Serializable class. Use one
1508 @serialField tag for each ObjectStreamField component.
1509
1510 @since since-text
1511 Introduced in JDK 1.1
1512
1513 Adds a Since heading with the specified since-text value to the
1514 generated documentation. The text has no special internal
1515 structure. This tag is valid in any documentation comment:
1516 overview, package, class, interface, constructor, method, or
1517 field. This tag means that this change or feature has existed
1518 since the software release specified by the since-text value,
1519 for example: @since 1.5.
1520
1521 For Java platform source code, the @since tag indicates the
1522 version of the Java platform API specification, which is not
1523 necessarily when the source code was added to the reference
1524 implementation. Multiple @since tags are allowed and are treated
1525 like multiple @author tags. You could use multiple tags when the
1526 program element is used by more than one API.
1527
1528 @throws class-namedescription
1529 Introduced in JDK 1.2
1530
1531 Behaves the same as the @exception tag. See @throws in How to
1532 Write Doc Comments for the Javadoc Tool at
1533 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@exception
1534
1535 The @throws tag adds a Throws subheading to the generated
1536 documentation, with the class-name and description text. The
1537 class-name is the name of the exception that might be thrown by
1538 the method. This tag is valid only in the documentation comment
1539 for a method or constructor. If this class is not fully
1540 specified, then the javadoc command uses the search order to
1541 look up this class. Multiple @throws tags can be used in a
1542 specified documentation comment for the same or different
1543 exceptions. See Search Order for the @see Tag.
1544
1545 To ensure that all checked exceptions are documented, when an
1546 @throws tag does not exist for an exception in the throws
1547 clause, the javadoc command adds that exception to the HTML
1548 output (with no description) as though it were documented with
1549 the @throws tag.
1550
1551 The @throws documentation is copied from an overridden method to
1552 a subclass only when the exception is explicitly declared in the
1553 overridden method. The same is true for copying from an
1554 interface method to an implementing method. You can use the
1555 {@inheritDoc} tag to force the @throws tag to inherit
1556 documentation.
1557
1558 {@value package.class#field}
1559 Introduced in JDK 1.4
1560
1561 Displays constant values. When the {@value} tag is used without
1562 an argument in the documentation comment of a static field, it
1563 displays the value of that constant:
1564
1565 /**
1566 * The value of this constant is {@value}.
1567 */
1568 public static final String SCRIPT_START = "<script>"
1569
1570
1571
1572 When used with the argument package.class#field in any
1573 documentation comment, he {@value} tag displays the value of the
1574 specified constant:
1575
1576 /**
1577 * Evaluates the script starting with {@value #SCRIPT_START}.
1578 */
1579 public String evalScript(String script) {}
1580
1581
1582
1583 The argument package.class#field takes a form similar to that of
1584 the @see tag argument, except that the member must be a static
1585 field.
1586
1587 The values of these constants are also displayed in Constant
1588 Field Values at
1589 http://docs.oracle.com/javase/8/docs/api/constant-values.html
1590
1591 @version version-text
1592 Introduced in JDK 1.0
1593
1594 Adds a Version subheading with the specified version-text value
1595 to the generated documents when the -version option is used.
1596 This tag is intended to hold the current release number of the
1597 software that this code is part of, as opposed to the@since tag,
1598 which holds the release number where this code was introduced.
1599 The version-text value has no special internal structure. See
1600 @version in How to Write Doc Comments for the Javadoc Tool at
1601 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#@version
1602
1603 A documentation comment can contain multiple @version tags. When
1604 it makes sense, you can specify one release number per @version
1605 tag or multiple release numbers per tag. In the former case, the
1606 javadoc command inserts a comma (,) and a space between the
1607 names. In the latter case, the entire text is copied to the
1608 generated document without being parsed. Therefore, you can use
1609 multiple names per line when you want a localized name separator
1610 other than a comma.
1611
1613 The following sections describe where tags can be used. Note that the
1614 following tags can be used in all documentation comments: @see, @since,
1615 @deprecated, {@link}, {@linkplain}, and {@docroot}.
1616
1617 OVERVIEW TAGS
1618 Overview tags are tags that can appear in the documentation comment for
1619 the overview page (which resides in the source file typically named
1620 overview.html). Similar to any other documentation comments, these tags
1621 must appear after the main description
1622
1623 Note: The {@link} tag has a bug in overview documents in Java SE 1.2.
1624 The text appears correctly but has no link. The {@docRoot} tag does not
1625 currently work in overview documents.
1626
1627 The overview tags are the following:
1628
1629 @see reference || @since since-text || @serialField field-name field-
1630 type field-description || @author name-text || @version version-text ||
1631 {@link package.class#member label} || {@linkplain package.class#member
1632 label} || {@docRoot} ||
1633
1634 PACKAGE TAGS
1635 Package tags are tags that can appear in the documentation comment for
1636 a package, that resides in the source file named package.html or
1637 package-info.java. The @serial tag can only be used here with the
1638 include or exclude argument.
1639
1640 The package tags are the following:
1641
1642 @see reference || @since since-text || @serial field-description |
1643 include | exclude || @author name-text || @version version-text ||
1644 {@linkplain package.class#member label} || {@linkplain
1645 package.class#member label} || {@docRoot} ||
1646
1647 CLASS AND INTERFACE TAGS
1648 The following are tags that can appear in the documentation comment for
1649 a class or interface. The @serial tag can only be used within the
1650 documentation for a class or interface with an include or exclude
1651 argument.
1652
1653 @see reference || @since since-text || @deprecated deprecated-text ||
1654 @serial field-description | include | exclude || @author name-text ||
1655 @version version-text || {@link package.class#member label} ||
1656 {@linkplain package.class#member label} || {@docRoot} ||
1657
1658 Class comment example:
1659
1660 /**
1661 * A class representing a window on the screen.
1662 * For example:
1663 * <pre>
1664 * Window win = new Window(parent);
1665 * win.show();
1666 * </pre>
1667 *
1668 * @author Sami Shaio
1669 * @version 1.13, 06/08/06
1670 * @see java.awt.BaseWindow
1671 * @see java.awt.Button
1672 */
1673 class Window extends BaseWindow {
1674 ...
1675 }
1676
1677
1678 FIELD TAGS
1679 These tags can appear in fields:
1680
1681 @see reference || @since since-text || @deprecated deprecated-text ||
1682 @serial field-description | include | exclude || @serialField field-
1683 name field-type field-description || {@link package.class#member label}
1684 || {@linkplain package.class#member label} || {@docRoot} || {@value
1685 package.class#field}
1686
1687 Field comment example:
1688
1689 /**
1690 * The X-coordinate of the component.
1691 *
1692 * @see #getLocation()
1693 */
1694 int x = 1263732;
1695
1696
1697 CONSTRUCTOR AND METHOD TAGS
1698 The following tags can appear in the documentation comment for a
1699 constructor or a method, except for the @return tag, which cannot
1700 appear in a constructor, and the {@inheritDoc} tag, which has
1701 restrictions.
1702
1703 @see reference || @since since-text || @deprecated deprecated-text ||
1704 @param parameter-name description || @return description || @throws
1705 class-name description || @exception class-name description ||
1706 @serialData data-description || {@link package.class#member label} ||
1707 {@linkplain package.class#member label} || {@inheritDoc} || {@docRoot}
1708
1709 Note: The @serialData tag can only be used in the documentation comment
1710 for the writeObject, readObject, writeExternal, readExternal,
1711 writeReplace, and readResolve methods.
1712
1713 Method comment example:
1714
1715 /**
1716 * Returns the character at the specified index. An index
1717 * ranges from <code>0</code> to <code>length() - 1</code>
1718 *
1719 * @param index the index of the desired character.
1720 * @return the desired character.
1721 * @exception StringIndexOutOfRangeException
1722 * if the index is not in the range <code>0</code>
1723 * to <code>length()-1</code>
1724 * @see java.lang.Character#charValue()
1725 */
1726 public char charAt(int index) {
1727 ...
1728 }
1729
1730
1732 The javadoc command uses doclets to determine its output. The javadoc
1733 command uses the default standard doclet unless a custom doclet is
1734 specified with the -doclet option. The javadoc command provides a set
1735 of command-line options that can be used with any doclet. These options
1736 are described in Javadoc Options. The standard doclet provides an
1737 additional set of command-line options that are described in Standard
1738 Doclet Options. All option names are not case-sensitive, but their
1739 arguments are case-sensitive.
1740
1741 · See also Javadoc Options
1742
1743 · See also Standard Doclet Options
1744
1745 The options are:
1746
1747 -1.1 || -author || -bootclasspath classpathlist || -bottom text ||
1748 -breakiterator || -charset name || -classpath classpathlist || -d
1749 directory || -docencoding name || -docfilesubdirs || -doclet class ||
1750 -docletpath classpathlist || -doctitle title || -encoding || -exclude
1751 packagename1:packagename2:... || -excludedocfilessubdir name1:name2 ||
1752 -extdirs dirist || -footer footer || -group groupheading
1753 packagepattern:packagepattern || -header header || -help || -helpfile
1754 path\filename || -Jflag || -javafx ||-keywords || -link extdocURL ||
1755 -linkoffline extdocURL packagelistLoc || -linksource || -locale
1756 language_country_variant || -nocomment || -nodeprecated ||
1757 -nodeprecatedlist || -nohelp || -noindex || -nonavbar || -noqualifier
1758 all | packagename1:packagename2... || -nosince || -notimestamp ||
1759 -notree || -overview path/filename || -package || -private ||
1760 -protected || -public || -quiet || -serialwarn || -source release ||
1761 -sourcepath sourcepathlist || -sourcetab tablength || -splitindex ||
1762 -stylesheet path/filename || -subpackages package1:package2:... || -tag
1763 tagname:Xaoptcmf:"taghead" || -taglet class || -tagletpath
1764 tagletpathlist || -title title || -top || -use || -verbose || -version
1765 || -windowtitle title
1766
1767 The following options are the core Javadoc options that are available
1768 to all doclets. The standard doclet provides the rest of the doclets:
1769 -bootclasspath, -breakiterator, -classpath, -doclet, -docletpath,
1770 -encoding, -exclude, -extdirs, -help, -locale, -overview, -package,
1771 -private, -protected, -public, -quiet, -source, -sourcepath,
1772 -subpackages, and -verbose.
1773
1774 JAVADOC OPTIONS
1775 -overview path/filename
1776 Specifies that the javadoc command should retrieve the text for
1777 the overview documentation from the source file specified by the
1778 path/filenameand place it on the Overview page (overview-
1779 summary.html). The path/filenameis relative to the current
1780 directory.
1781
1782 While you can use any name you want for the filename value and
1783 place it anywhere you want for the path, it is typical to name
1784 it overview.html and place it in the source tree at the
1785 directory that contains the topmost package directories. In this
1786 location, no path is needed when documenting packages, because
1787 the -sourcepath option points to this file.
1788
1789 For example, if the source tree for the java.lang package is
1790 /src/classes/java/lang/, then you could place the overview file
1791 at /src/classes/overview.html
1792
1793 See Real-World Examples.
1794
1795 For information about the file specified by path/filename,see
1796 Overview Comment Files.
1797
1798 The overview page is created only when you pass two or more
1799 package names to the javadoc command. For a further explanation,
1800 see HTML Frames. The title on the overview page is set by
1801 -doctitle.
1802
1803 -Xdoclint:(all|none|[-]<group>)
1804 Reports warnings for bad references, lack of accessibility and
1805 missing Javadoc comments, and reports errors for invalid Javadoc
1806 syntax and missing HTML tags.
1807
1808 This option enables the javadoc command to check for all
1809 documentation comments included in the generated output. As
1810 always, you can select which items to include in the generated
1811 output with the standard options -public, -protected, -package
1812 and -private.
1813
1814 When the -Xdoclint is enabled, it reports issues with messages
1815 similar to the javac command. The javadoc command prints a
1816 message, a copy of the source line, and a caret pointing at the
1817 exact position where the error was detected. Messages may be
1818 either warnings or errors, depending on their severity and the
1819 likelihood to cause an error if the generated documentation were
1820 run through a validator. For example, bad references or missing
1821 Javadoc comments do not cause the javadoc command to generate
1822 invalid HTML, so these issues are reported as warnings. Syntax
1823 errors or missing HTML end tags cause the javadoc command to
1824 generate invalid output, so these issues are reported as errors.
1825
1826 By default, the -Xdoclint option is enabled. Disable it with the
1827 option -Xdoclint:none.
1828
1829 Change what the -Xdoclint option reports with the following
1830 options:
1831
1832 · -Xdoclint none : disable the -Xdoclint option
1833
1834 · -Xdoclintgroup : enable group checks
1835
1836 · -Xdoclint all : enable all groups of checks
1837
1838 · -Xdoclint all,-group : enable all except group checks
1839
1840
1841 The variable group has one of the following values:
1842
1843 · accessibility : Checks for the issues to be detected by an
1844 accessibility checker (for example, no caption or summary
1845 attributes specified in a <table> tag).
1846
1847 · html : Detects high-level HTML issues, like putting block
1848 elements inside inline elements, or not closing elements that
1849 require an end tag. The rules are derived from theHTML 4.01
1850 Specification. This type of check enables the javadoc command
1851 to detect HTML issues that many browsers might accept.
1852
1853 · missing : Checks for missing Javadoc comments or tags (for
1854 example, a missing comment or class, or a missing @return tag
1855 or similar tag on a method).
1856
1857 · reference : Checks for issues relating to the references to
1858 Java API elements from Javadoc tags (for example, item not
1859 found in @see , or a bad name after @param).
1860
1861 · syntax : Checks for low level issues like unescaped angle
1862 brackets (< and >) and ampersands (&) and invalid Javadoc
1863 tags.
1864
1865
1866 You can specify the -Xdoclint option multiple times to enable the
1867 option to check errors and warnings in multiple categories.
1868 Alternatively, you can specify multiple error and warning categories by
1869 using the preceding options. For example, use either of the following
1870 commands to check for the HTML, syntax, and accessibility issues in the
1871 file filename.
1872
1873 javadoc -Xdoclint:html -Xdoclint:syntax -Xdoclint:accessibility filename
1874 javadoc -Xdoclint:html,syntax,accessibility filename
1875
1876
1877
1878 Note: The javadoc command does not guarantee the completeness of these
1879 checks. In particular, it is not a full HTML compliance checker. The
1880 goal of the -Xdoclint option is to enable the javadoc command to report
1881 majority of common errors.
1882
1883 The javadoc command does not attempt to fix invalid input, it just
1884 reports it.
1885
1886 -public
1887 Shows only public classes and members.
1888
1889 -protected
1890 Shows only protected and public classes and members. This is the
1891 default.
1892
1893 -package
1894 Shows only package, protected, and public classes and members.
1895
1896 -private
1897 Shows all classes and members.
1898
1899 -help
1900 Displays the online help, which lists all of the javadoc and
1901 doclet command-line options.
1902
1903 -doclet class
1904 Specifies the class file that starts the doclet used in
1905 generating the documentation. Use the fully qualified name. This
1906 doclet defines the content and formats the output. If the
1907 -doclet option is not used, then the javadoc command uses the
1908 standard doclet for generating the default HTML format. This
1909 class must contain the start(Root) method. The path to this
1910 starting class is defined by the -docletpath option. See Doclet
1911 Overview at
1912 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html
1913
1914 -docletpath classpathlist
1915 Specifies the path to the doclet starting class file (specified
1916 with the -doclet option) and any JAR files it depends on. If the
1917 starting class file is in a JAR file, then this option specifies
1918 the path to that JAR file. You can specify an absolute path or a
1919 path relative to the current directory. If classpathlist
1920 contains multiple paths or JAR files, then they should be
1921 separated with a colon (:) on Oracle Solaris and a semi-colon
1922 (;) on Windows. This option is not necessary when the doclet
1923 starting class is already in the search path. See Doclet
1924 Overview at
1925 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html
1926
1927 -1.1
1928 Removed from Javadoc 1.4 with no replacement. This option
1929 created documentation with the appearance and functionality of
1930 documentation generated by Javadoc 1.1 (it never supported
1931 nested classes). If you need this option, then use Javadoc 1.2
1932 or 1.3 instead.
1933
1934 -source release
1935 Specifies the release of source code accepted. The following
1936 values for the release parameter are allowed. Use the value of
1937 release that corresponds to the value used when you compile code
1938 with the javac command.
1939
1940 · Release Value: 1.5. The javadoc command accepts code
1941 containing generics and other language features introduced in
1942 JDK 1.5. The compiler defaults to the 1.5 behavior when the
1943 -source option is not used.
1944
1945 · Release Value: 1.4. The javadoc command accepts code
1946 containing assertions, which were introduced in JDK 1.4.
1947
1948 · Release Value: 1.3. The javadoc command does not support
1949 assertions, generics, or other language features introduced
1950 after JDK 1.3.
1951
1952
1953 -sourcepath sourcepathlist
1954 Specifies the search paths for finding source files when passing
1955 package names or the -subpackages option into the javadoc
1956 command. Separate multiple paths with a colon (:). The javadoc
1957 command searches all subdirectories of the specified paths. Note
1958 that this option is not only used to locate the source files
1959 being documented, but also to find source files that are not
1960 being documented, but whose comments are inherited by the source
1961 files being documented.
1962
1963 You can use the -sourcepath option only when passing package
1964 names into the javadoc command. This will not locate source
1965 files passed into the javadoc command. To locate source files,
1966 change to that directory or include the path ahead of each file,
1967 as shown at Document One or More Classes. If you omit
1968 -sourcepath, then the javadoc command uses the class path to
1969 find the source files (see -classpath). The default -sourcepath
1970 is the value of class path. If -classpath is omitted and you
1971 pass package names into the javadoc command, then the javadoc
1972 command searches in the current directory and subdirectories for
1973 the source files.
1974
1975 Set sourcepathlist to the root directory of the source tree for
1976 the package you are documenting.
1977
1978 For example, suppose you want to document a package called
1979 com.mypackage, whose source files are located
1980 at:/home/user/src/com/mypackage/*.java. Specify the sourcepath
1981 to /home/user/src, the directory that contains com\mypackage,
1982 and then supply the package name, as follows:
1983
1984 javadoc -sourcepath /home/user/src/ com.mypackage
1985
1986
1987
1988 Notice that if you concatenate the value of sourcepath and the
1989 package name together and change the dot to a slash (/), then
1990 you have the full path to the package:
1991
1992 /home/user/src/com/mypackage
1993
1994 To point to two source paths:
1995
1996 javadoc -sourcepath /home/user1/src:/home/user2/src com.mypackage
1997
1998
1999
2000 -classpath classpathlist
2001 Specifies the paths where the javadoc command searches for
2002 referenced classes These are the documented classes plus any
2003 classes referenced by those classes. Separate multiple paths
2004 with a colon (:). The javadoc command searches all
2005 subdirectories of the specified paths. Follow the instructions
2006 in the class path documentation for specifying the classpathlist
2007 value.
2008
2009 If you omit -sourcepath, then the javadoc command uses
2010 -classpath to find the source files and class files (for
2011 backward compatibility). If you want to search for source and
2012 class files in separate paths, then use both -sourcepath and
2013 -classpath.
2014
2015 For example, if you want to document com.mypackage, whose source
2016 files reside in the directory /home/user/src/com/mypackage, and
2017 if this package relies on a library in /home/user/lib, then you
2018 would use the following command:
2019
2020 javadoc -sourcepath /home/user/lib -classpath /home/user/src com.mypackage
2021
2022
2023
2024 Similar to other tools, if you do not specify -classpath, then
2025 the javadoc command uses the CLASSPATH environment variable when
2026 it is set. If both are not set, then the javadoc command
2027 searches for classes from the current directory.
2028
2029 For an in-depth description of how the javadoc command uses
2030 -classpath to find user classes as it relates to extension
2031 classes and bootstrap classes, see How Classes Are Found at
2032 http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
2033
2034 A class path element that contains a base name of * is
2035 considered equivalent to specifying a list of all the files in
2036 the directory with the extension .jar or .JAR.
2037
2038 For example, if directory mydir contains a.jar and b.JAR, then
2039 the class path element foo/* is expanded to a A.jar:b.JAR,
2040 except that the order of JAR files is unspecified. All JAR files
2041 in the specified directory including hidden files are included
2042 in the list. A class path entry that consists of * expands to a
2043 list of all the jar files in the current directory. The
2044 CLASSPATH environment variable is similarly expanded. Any class
2045 path wildcard expansion occurs before the Java Virtual Machine
2046 (JVM) starts. No Java program ever sees unexpanded wild cards
2047 except by querying the environment, for example, by calling
2048 System.getenv("CLASSPATH").
2049
2050 -subpackages package1:package2:...
2051 Generates documentation from source files in the specified
2052 packages and recursively in their subpackages. This option is
2053 useful when adding new subpackages to the source code because
2054 they are automatically included. Each package argument is any
2055 top-level subpackage (such as java) or fully qualified package
2056 (such as javax.swing) that does not need to contain source
2057 files. Arguments are separated by colons on all operating
2058 systems. Wild cards are not allowed. Use -sourcepath to specify
2059 where to find the packages. This option does not process source
2060 files that are in the source tree but do not belong to the
2061 packages. See Process Source Files.
2062
2063 For example, the following command generates documentation for
2064 packages named java and javax.swing and all of their
2065 subpackages.
2066
2067 javadoc -d docs -sourcepath /home/user/src -subpackages java:javax.swing
2068
2069
2070
2071 -exclude packagename1:packagename2:...
2072 Unconditionally excludes the specified packages and their
2073 subpackages from the list formed by -subpackages. It excludes
2074 those packages even when they would otherwise be included by
2075 some earlier or later -subpackages option.
2076
2077 The following example would include java.io, java.util, and
2078 java.math (among others), but would exclude packages rooted at
2079 java.net and java.lang. Notice that this example excludes
2080 java.lang.ref, which is a subpackage of java.lang.
2081
2082 javadoc -sourcepath /home/user/src -subpackages java -exclude
2083 java.net:java.lang
2084
2085
2086
2087 -bootclasspath classpathlist
2088 Specifies the paths where the boot classes reside. These are
2089 typically the Java platform classes. The bootclasspath is part
2090 of the search path the javadoc command uses to look up source
2091 and class files. For more information, see How Classes Are Found
2092 at
2093 http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
2094
2095 Separate directories in the classpathlist parameters with
2096 semicolons (;) for Windows and colons (:) for Oracle Solaris.
2097
2098 -extdirs dirist
2099 Specifies the directories where extension classes reside. These
2100 are any classes that use the Java Extension mechanism. The
2101 extdirs option is part of the search path the javadoc command
2102 uses to look up source and class files. See the -classpath
2103 option for more information. Separate directories in dirlist
2104 with semicolons (;) for Windows and colons (:) for Oracle
2105 Solaris.
2106
2107 -verbose
2108 Provides more detailed messages while the javadoc command runs.
2109 Without the verbose option, messages appear for loading the
2110 source files, generating the documentation (one message per
2111 source file), and sorting. The verbose option causes the
2112 printing of additional messages that specify the number of
2113 milliseconds to parse each Java source file.
2114
2115 -quiet
2116 Shuts off messages so that only the warnings and errors appear
2117 to make them easier to view. It also suppresses the version
2118 string.
2119
2120 -breakiterator
2121 Uses the internationalized sentence boundary of
2122 java.text.BreakIterator to determine the end of the first
2123 sentence in the main description of a package, class, or member
2124 for English. All other locales already use the BreakIterator
2125 class, rather than an English language, locale-specific
2126 algorithm. The first sentence is copied to the package, class,
2127 or member summary and to the alphabetic index. From JDK 1.2 and
2128 later, the BreakIterator class is used to determine the end of a
2129 sentence for all languages except for English. Therefore, the
2130 -breakiterator option has no effect except for English from 1.2
2131 and later. English has its own default algorithm:
2132
2133 · English default sentence-break algorithm. Stops at a period
2134 followed by a space or an HTML block tag, such as <P>.
2135
2136 · Breakiterator sentence-break algorithm. Stops at a period,
2137 question mark, or exclamation point followed by a space when
2138 the next word starts with a capital letter. This is meant to
2139 handle most abbreviations (such as "The serial no. is valid",
2140 but will not handle "Mr. Smith"). The -breakiterator option
2141 does not stop at HTML tags or sentences that begin with
2142 numbers or symbols. The algorithm stops at the last period in
2143 ../filename, even when embedded in an HTML tag.
2144
2145
2146 In Java SE 1.5 the -breakiterator option warning messages are removed,
2147 and the default sentence-break algorithm is unchanged. If you have not
2148 modified your source code to eliminate the -breakiterator option
2149 warnings in Java SE 1.4.x, then you do not have to do anything. The
2150 warnings go away starting with Java SE 1.5.0.
2151
2152 -locale language_country_variant
2153 Specifies the locale that the javadoc command uses when it
2154 generates documentation. The argument is the name of the locale,
2155 as described in java.util.Locale documentation, such as en_US
2156 (English, United States) or en_US_WIN (Windows variant).
2157
2158 Note: The -locale option must be placed ahead (to the left) of
2159 any options provided by the standard doclet or any other doclet.
2160 Otherwise, the navigation bars appear in English. This is the
2161 only command-line option that depends on order. See Standard
2162 Doclet Options.
2163
2164 Specifying a locale causes the javadoc command to choose the
2165 resource files of that locale for messages such as strings in
2166 the navigation bar, headings for lists and tables, help file
2167 contents, comments in the stylesheet.css file, and so on. It
2168 also specifies the sorting order for lists sorted
2169 alphabetically, and the sentence separator to determine the end
2170 of the first sentence. The -locale option does not determine the
2171 locale of the documentation comment text specified in the source
2172 files of the documented classes.
2173
2174 -encoding
2175 Specifies the encoding name of the source files, such as
2176 EUCJIS/SJIS. If this option is not specified, then the platform
2177 default converter is used. See also the-docencoding name and
2178 -charset name options.
2179
2180 -Jflag
2181 Passes flag directly to the Java Runtime Environment (JRE) that
2182 runs the javadoc command. For example, if you must ensure that
2183 the system sets aside 32 MB of memory in which to process the
2184 generated documentation, then you would call the -Xmx option as
2185 follows: javadoc -J-Xmx32m -J-Xms32m com.mypackage. Be aware
2186 that -Xms is optional because it only sets the size of initial
2187 memory, which is useful when you know the minimum amount of
2188 memory required.
2189
2190 There is no space between the J and the flag.
2191
2192 Use the -version option to find out what version of the javadoc
2193 command you are using. The version number of the standard doclet
2194 appears in its output stream. See Running the Javadoc Command.
2195
2196 javadoc -J-version
2197 java version "1.7.0_09"
2198 Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
2199 Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
2200
2201
2202
2203 -javafx
2204 Generates HTML documentation using the JavaFX extensions to the
2205 standard doclet. The generated documentation includes a Property
2206 Summary section in addition to the other summary sections
2207 generated by the standard Java doclet. The listed properties are
2208 linked to the sections for the getter and setter methods of each
2209 property.
2210
2211 If there are no documentation comments written explicitly for
2212 getter and setter methods, the documentation comments from the
2213 property method are automatically copied to the generated
2214 documentation for these methods. This option also adds a new
2215 @defaultValue tag that allows documenting the default value for
2216 a property.
2217
2218 Example:
2219
2220 javadoc -javafx MyClass.java -d testdir
2221
2222
2223
2224 STANDARD DOCLET OPTIONS
2225 -d directory
2226 Specifies the destination directory where the javadoc command
2227 saves the generated HTML files. If you omit the -d option, then
2228 the files are saved to the current directory. The directory
2229 value can be absolute or relative to the current working
2230 directory. As of Java SE 1.4, the destination directory is
2231 automatically created when the javadoc command runs.
2232
2233 For example, the following command generates the documentation
2234 for the package com.mypackage and saves the results in the
2235 /user/doc/ directory: javadoc -d/user/doc/com.mypackage.
2236
2237 -use
2238 Includes one Use page for each documented class and package. The
2239 page describes what packages, classes, methods, constructors and
2240 fields use any API of the specified class or package. Given
2241 class C, things that use class C would include subclasses of C,
2242 fields declared as C, methods that return C, and methods and
2243 constructors with parameters of type C. For example, you can
2244 look at the Use page for the String type. Because the getName
2245 method in the java.awt.Font class returns type String, the
2246 getName method uses String and so the getName method appears on
2247 the Use page for String.This documents only uses of the API, not
2248 the implementation. When a method uses String in its
2249 implementation, but does not take a string as an argument or
2250 return a string, that is not considered a use of String.To
2251 access the generated Use page, go to the class or package and
2252 click the Use link in the navigation bar.
2253
2254 -version
2255 Includes the @version text in the generated docs. This text is
2256 omitted by default. To find out what version of the javadoc
2257 command you are using, use the -J-version option.
2258
2259 -author
2260 Includes the @author text in the generated docs.
2261
2262 -splitindex
2263 Splits the index file into multiple files, alphabetically, one
2264 file per letter, plus a file for any index entries that start
2265 with non-alphabetical symbols.
2266
2267 -windowtitle title
2268 Specifies the title to be placed in the HTML <title> tag. The
2269 text specified in the title tag appears in the window title and
2270 in any browser bookmarks (favorite places) that someone creates
2271 for this page. This title should not contain any HTML tags
2272 because the browser does not interpret them correctly. Use
2273 escape characters on any internal quotation marks within the
2274 title tag. If the -windowtitle option is omitted, then the
2275 javadoc command uses the value of the -doctitle option for the
2276 -windowtitle option. For example, javadoc -windowtitle "Java SE
2277 Platform" com.mypackage.
2278
2279 -doctitle title
2280 Specifies the title to place near the top of the overview
2281 summary file. The text specified in the title tag is placed as a
2282 centered, level-one heading directly beneath the top navigation
2283 bar. The title tag can contain HTML tags and white space, but
2284 when it does, you must enclose the title in quotation marks.
2285 Internal quotation marks within the title tag must be escaped.
2286 For example, javadoc -header "<b>Java Platform </b><br>v1.4"
2287 com.mypackage.
2288
2289 -title title
2290 No longer exists. It existed only in Beta releases of Javadoc
2291 1.2. It was renamed to -doctitle. This option was renamed to
2292 make it clear that it defines the document title, rather than
2293 the window title.
2294
2295 -header header
2296 Specifies the header text to be placed at the top of each output
2297 file. The header is placed to the right of the upper navigation
2298 bar. The header can contain HTML tags and white space, but when
2299 it does, the header must be enclosed in quotation marks. Use
2300 escape characters for internal quotation marks within a header.
2301 For example, javadoc -header "<b>Java Platform </b><br>v1.4"
2302 com.mypackage.
2303
2304 -footer footer
2305 Specifies the footer text to be placed at the bottom of each
2306 output file. The footer value is placed to the right of the
2307 lower navigation bar. The footer value can contain HTML tags and
2308 white space, but when it does, the footer value must be enclosed
2309 in quotation marks. Use escape characters for any internal
2310 quotation marks within a footer.
2311
2312 -top
2313 Specifies the text to be placed at the top of each output file.
2314
2315 -bottom text
2316 Specifies the text to be placed at the bottom of each output
2317 file. The text is placed at the bottom of the page, underneath
2318 the lower navigation bar. The text can contain HTML tags and
2319 white space, but when it does, the text must be enclosed in
2320 quotation marks. Use escape characters for any internal
2321 quotation marks within text.
2322
2323 -link extdocURL
2324 Creates links to existing Javadoc-generated documentation of
2325 externally referenced classes. The extdocURL argument is the
2326 absolute or relative URL of the directory that contains the
2327 external Javadoc-generated documentation you want to link to.
2328 You can specify multiple -link options in a specified javadoc
2329 command run to link to multiple documents.
2330
2331 The package-list file must be found in this directory
2332 (otherwise, use the -linkoffline option). The javadoc command
2333 reads the package names from the package-list file and links to
2334 those packages at that URL. When the javadoc command runs, the
2335 extdocURL value is copied into the <A HREF> links that are
2336 created. Therefore, extdocURL must be the URL to the directory,
2337 and not to a file. You can use an absolute link for extdocURL to
2338 enable your documents to link to a document on any web site, or
2339 you can use a relative link to link only to a relative location.
2340 If you use a relative link, then the value you pass in should be
2341 the relative path from the destination directory (specified with
2342 the -d option) to the directory containing the packages being
2343 linked to.When you specify an absolute link, you usually use an
2344 HTTP link. However, if you want to link to a file system that
2345 has no web server, then you can use a file link. Use a file link
2346 only when everyone who wants to access the generated
2347 documentation shares the same file system.In all cases, and on
2348 all operating systems, use a slash as the separator, whether the
2349 URL is absolute or relative, and http: or file: as specified in
2350 the URL Memo: Uniform Resource Locators at
2351 http://www.ietf.org/rfc/rfc1738.txt
2352
2353 -link http://<host>/<directory>/<directory>/.../<name>
2354 -link file://<host>/<directory>/<directory>/.../<name>
2355 -link <directory>/<directory>/.../<name>
2356
2357
2358
2359 Differences between the -linkoffline and -link options
2360
2361 Use the -link option in the following cases:
2362
2363 · When you use a relative path to the external API document.
2364
2365 · When you use an absolute URL to the external API document if your
2366 shell lets you open a connection to that URL for reading.
2367
2368 Use the -linkoffline option when you use an absolute URL to the
2369 external API document, if your shell does not allow a program to open a
2370 connection to that URL for reading. This can occur when you are behind
2371 a firewall and the document you want to link to is on the other side.
2372
2373 Example 1 Absolute Link to External Documents
2374
2375 Use the following command if you want to link to the java.lang, java.io
2376 and other Java platform packages, shown at
2377 http://docs.oracle.com/javase/8/docs/api/index.html
2378
2379 javadoc -link http://docs.oracle.com/javase/8/docs/api/ com.mypackage
2380
2381 The command generates documentation for the package com.mypackage with
2382 links to the Java SE packages. The generated documentation contains
2383 links to the Object class, for example, in the class trees. Other
2384 options, such as the -sourcepath and -d options, are not shown.
2385
2386 Example 2 Relative Link to External Documents
2387
2388 In this example, there are two packages with documents that are
2389 generated in different runs of the javadoc command, and those documents
2390 are separated by a relative path. The packages are com.apipackage, an
2391 API, and com.spipackage, an Service Provide Interface (SPI). You want
2392 the documentation to reside in docs/api/com/apipackage and
2393 docs/spi/com/spipackage. Assuming that the API package documentation is
2394 already generated, and that docs is the current directory, you document
2395 the SPI package with links to the API documentation by running: javadoc
2396 -d ./spi -link ../api com.spipackage.
2397
2398 Notice the -link option is relative to the destination directory
2399 (docs/spi).
2400
2401 Notes
2402
2403 The -link option lets you link to classes referenced to by your code,
2404 but not documented in the current javadoc command run. For these links
2405 to go to valid pages, you must know where those HTML pages are located
2406 and specify that location with extdocURL. This allows third-party
2407 documentation to link to java.* documentation at
2408 http://docs.oracle.com.Omit the -link option when you want the javadoc
2409 command to create links only to APIs within the documentation it is
2410 generating in the current run. Without the -link option, the javadoc
2411 command does not create links to documentation for external references
2412 because it does not know whether or where that documentation exists.The
2413 -link option can create links in several places in the generated
2414 documentation. See Process Source Files. Another use is for cross-links
2415 between sets of packages: Execute the javadoc command on one set of
2416 packages, then run the javadoc command again on another set of
2417 packages, creating links both ways between both sets.
2418
2419 How to Reference a Class
2420
2421 For a link to an externally referenced class to appear (and not just
2422 its text label), the class must be referenced in the following way. It
2423 is not sufficient for it to be referenced in the body of a method. It
2424 must be referenced in either an import statement or in a declaration.
2425 Here are examples of how the class java.io.File can be referenced:
2426
2427 In any kind of import statement. By wildcard import, import explicitly
2428 by name, or automatically import for java.lang.*.
2429
2430 In Java SE 1.3.n and 1.2.n, only an explicit import by name works. A
2431 wildcard import statement does not work, nor does the automatic import
2432 java.lang.*.
2433
2434 In a declaration: void mymethod(File f) {}
2435
2436 The reference can be in the return type or parameter type of a method,
2437 constructor, field, class, or interface, or in an implements, extends,
2438 or throws statement.
2439
2440 An important corollary is that when you use the -link option, there can
2441 be many links that unintentionally do not appear due to this
2442 constraint. The text would appear without being a link. You can detect
2443 these by the warnings they emit. The simplest way to properly reference
2444 a class and add the link would be to import that class.
2445
2446 Package List
2447
2448 The -link option requires that a file named package-list, which is
2449 generated by the javadoc command, exists at the URL you specify with
2450 the -link option. The package-list file is a simple text file that
2451 lists the names of packages documented at that location. In the earlier
2452 example, the javadoc command searches for a file named package-list at
2453 the specified URL, reads in the package names, and links to those
2454 packages at that URL.
2455
2456 For example, the package list for the Java SE API is located at
2457 http://docs.oracle.com/javase/8/docs/api/package-list
2458
2459 The package list starts as follows:
2460
2461 java.applet
2462 java.awt
2463 java.awt.color
2464 java.awt.datatransfer
2465 java.awt.dnd
2466 java.awt.event
2467 java.awt.font
2468 and so on ....
2469
2470 When javadoc is run without the -link option and encounters a name that
2471 belongs to an externally referenced class, it prints the name with no
2472 link. However, when the -link option is used, the javadoc command
2473 searches the package-list file at the specified extdocURL location for
2474 that package name. When it finds the package name, it prefixes the name
2475 with extdocURL.
2476
2477 For there to be no broken links, all of the documentation for the
2478 external references must exist at the specified URLs. The javadoc
2479 command does not check that these pages exist, but only that the
2480 package-list exists.
2481
2482 Multiple Links
2483
2484 You can supply multiple -link options to link to any number of
2485 externally generated documents. Javadoc 1.2 has a known bug that
2486 prevents you from supplying more than one -link options. This was fixed
2487 in Javadoc 1.2.2. Specify a different link option for each external
2488 document to link to javadoc -link extdocURL1 -link extdocURL2 ... -link
2489 extdocURLn com.mypackage where extdocURL1, extdocURL2, ... extdocURLn
2490 point respectively to the roots of external documents, each of which
2491 contains a file named package-list.
2492
2493 Cross Links
2494
2495 Note that bootstrapping might be required when cross-linking two or
2496 more documents that were previously generated. If package-list does not
2497 exist for either document when you run the javadoc command on the first
2498 document, then the package-list does not yet exist for the second
2499 document. Therefore, to create the external links, you must regenerate
2500 the first document after you generate the second document.
2501
2502 In this case, the purpose of first generating a document is to create
2503 its package-list (or you can create it by hand if you are certain of
2504 the package names). Then, generate the second document with its
2505 external links. The javadoc command prints a warning when a needed
2506 external package-list file does not exist.
2507
2508 -linkoffline extdocURL packagelistLoc
2509 This option is a variation of the -link option. They both create
2510 links to Javadoc-generated documentation for externally
2511 referenced classes. Use the -linkoffline option when linking to
2512 a document on the web when the javadoc command cannot access the
2513 document through a web connection. Use the -linkoffline option
2514 when package-list file of the external document is not
2515 accessible or does not exist at the extdocURL location, but does
2516 exist at a different location that can be specified by
2517 packageListLoc (typically local). If extdocURL is accessible
2518 only on the World Wide Web, then the -linkoffline option removes
2519 the constraint that the javadoc command must have a web
2520 connection to generate documentation. Another use is as a work-
2521 around to update documents: After you have run the javadoc
2522 command on a full set of packages, you can run the javadoc
2523 command again on a smaller set of changed packages, so that the
2524 updated files can be inserted back into the original set.
2525 Examples follow. The -linkoffline option takes two arguments.
2526 The first is for the string to be embedded in the <a href>
2527 links, and the second tells the -linkoffline option where to
2528 find package-list:
2529
2530 · The extdocURL value is the absolute or relative URL of the
2531 directory that contains the external Javadoc-generated
2532 documentation you want to link to. When relative, the value
2533 should be the relative path from the destination directory
2534 (specified with the -d option) to the root of the packages
2535 being linked to. For more information, see extdocURL in the
2536 -link option.
2537
2538 · The packagelistLoc value is the path or URL to the directory
2539 that contains the package-list file for the external
2540 documentation. This can be a URL (http: or file:) or file
2541 path, and can be absolute or relative. When relative, make it
2542 relative to the current directory from where the javadoc
2543 command was run. Do not include the package-list file name.
2544
2545 You can specify multiple -linkoffline options in a specified
2546 javadoc command run. Before Javadoc 1.2.2, the -linkfile
2547 options could be specified once.
2548
2549
2550 Absolute Links to External Documents
2551
2552 You might have a situation where you want to link to the java.lang,
2553 java.io and other Java SE packages at
2554 http://docs.oracle.com/javase/8/docs/api/index.html
2555
2556 However, your shell does not have web access. In this case, do the
2557 following:
2558
2559 1. Open the package-list file in a browser at
2560 http://docs.oracle.com/javase/8/docs/api/package-list
2561
2562 2. Save the file to a local directory, and point to this local copy
2563 with the second argument, packagelistLoc. In this example, the
2564 package list file was saved to the current directory (.).
2565
2566 The following command generates documentation for the package
2567 com.mypackage with links to the Java SE packages. The generated
2568 documentation will contain links to the Object class, for example, in
2569 the class trees. Other necessary options, such as -sourcepath, are not
2570 shown.
2571
2572 javadoc -linkoffline http://docs.oracle.com/javase/8/docs/api/ . com.mypackage
2573
2574
2575
2576 Relative Links to External Documents
2577
2578 It is not very common to use -linkoffline with relative paths, for the
2579 simple reason that the -link option is usually enough. When you use the
2580 -linkoffline option, the package-list file is usually local, and when
2581 you use relative links, the file you are linking to is also local, so
2582 it is usually unnecessary to give a different path for the two
2583 arguments to the -linkoffline option When the two arguments are
2584 identical, you can use the -link option.
2585
2586 Create a package-list File Manually
2587
2588 If a package-list file does not exist yet, but you know what package
2589 names your document will link to, then you can manually create your own
2590 copy of this file and specify its path with packagelistLoc. An example
2591 would be the previous case where the package list for com.spipackage
2592 did not exist when com.apipackage was first generated. This technique
2593 is useful when you need to generate documentation that links to new
2594 external documentation whose package names you know, but which is not
2595 yet published. This is also a way of creating package-list files for
2596 packages generated with Javadoc 1.0 or 1.1, where package-list files
2597 were not generated. Similarly, two companies can share their
2598 unpublished package-list files so they can release their cross-linked
2599 documentation simultaneously.
2600
2601 Link to Multiple Documents
2602
2603 You can include the -linkoffline option once for each generated
2604 document you want to refer to:
2605
2606 javadoc -linkoffline extdocURL1 packagelistLoc1 -linkoffline extdocURL2
2607 packagelistLoc2 ...
2608
2609
2610
2611 Update Documents
2612
2613 You can also use the -linkoffline option when your project has dozens
2614 or hundreds of packages. If you have already run the javadoc command on
2615 the entire source tree, then you can quickly make small changes to
2616 documentation comments and rerun the javadoc command on a portion of
2617 the source tree. Be aware that the second run works properly only when
2618 your changes are to documentation comments and not to declarations. If
2619 you were to add, remove, or change any declarations from the source
2620 code, then broken links could show up in the index, package tree,
2621 inherited member lists, Use page, and other places.
2622
2623 First, create a new destination directory, such as update, for this new
2624 small run. In this example, the original destination directory is named
2625 html. In the simplest example, change directory to the parent of html.
2626 Set the first argument of the -linkoffline option to the current
2627 directory (.) and set the second argument to the relative path to html,
2628 where it can find package-list and pass in only the package names of
2629 the packages you want to update:
2630
2631 javadoc -d update -linkoffline . html com.mypackage
2632
2633 When the javadoc command completes, copy these generated class pages in
2634 update/com/package (not the overview or index) to the original files in
2635 html/com/package.
2636
2637 -linksource
2638 Creates an HTML version of each source file (with line numbers)
2639 and adds links to them from the standard HTML documentation.
2640 Links are created for classes, interfaces, constructors,
2641 methods, and fields whose declarations are in a source file.
2642 Otherwise, links are not created, such as for default
2643 constructors and generated classes.
2644
2645 This option exposes all private implementation details in the
2646 included source files, including private classes, private
2647 fields, and the bodies of private methods, regardless of the
2648 -public, -package, -protected, and -private options. Unless you
2649 also use the -private option, not all private classes or
2650 interfaces are accessible through links.
2651
2652 Each link appears on the name of the identifier in its
2653 declaration. For example, the link to the source code of the
2654 Button class would be on the word Button:
2655
2656 public class Button extends Component implements Accessible
2657
2658
2659
2660 The link to the source code of the getLabel method in the Button
2661 class is on the word getLabel:
2662
2663 public String getLabel()
2664
2665
2666
2667 -group groupheading packagepattern:packagepattern
2668 Separates packages on the overview page into whatever groups you
2669 specify, one group per table. You specify each group with a
2670 different -group option. The groups appear on the page in the
2671 order specified on the command line. Packages are alphabetized
2672 within a group. For a specified -group option, the packages
2673 matching the list of packagepattern expressions appear in a
2674 table with the heading groupheading.
2675
2676 · The groupheading can be any text and can include white space.
2677 This text is placed in the table heading for the group.
2678
2679 · The packagepattern value can be any package name at the start
2680 of any package name followed by an asterisk (*). The asterisk
2681 is the only wildcard allowed and means match any characters.
2682 Multiple patterns can be included in a group by separating
2683 them with colons (:). If you use an asterisk in a pattern or
2684 pattern list, then the pattern list must be inside quotation
2685 marks, such as "java.lang*:java.util".
2686
2687
2688 When you do not supply a -group option, all packages are placed in one
2689 group with the heading Packages and appropriate subheadings. If the
2690 subheadings do not include all documented packages (all groups), then
2691 the remaining packages appear in a separate group with the subheading
2692 Other Packages.
2693
2694 For example, the following javadoc command separates the three
2695 documented packages into Core, Extension, and Other Packages. The
2696 trailing dot (.) does not appear in java.lang*. Including the dot, such
2697 as java.lang.* omits thejava.lang package.
2698
2699 javadoc -group "Core Packages" "java.lang*:java.util"
2700 -group "Extension Packages" "javax.*"
2701 java.lang java.lang.reflect java.util javax.servlet java.new
2702
2703
2704
2705 Core Packages
2706
2707 java.lang
2708
2709 java.lang.reflect
2710
2711 java.util
2712
2713 Extension Packages
2714
2715 javax.servlet
2716
2717 Other Packages
2718
2719 java.new
2720
2721 -nodeprecated
2722 Prevents the generation of any deprecated API in the
2723 documentation. This does what the -nodeprecatedlist option does,
2724 and it does not generate any deprecated API throughout the rest
2725 of the documentation. This is useful when writing code when you
2726 do not want to be distracted by the deprecated code.
2727
2728 -nodeprecatedlist
2729 Prevents the generation of the file that contains the list of
2730 deprecated APIs (deprecated-list.html) and the link in the
2731 navigation bar to that page. The javadoc command continues to
2732 generate the deprecated API throughout the rest of the document.
2733 This is useful when your source code contains no deprecated
2734 APIs, and you want to make the navigation bar cleaner.
2735
2736 -nosince
2737 Omits from the generated documents the Since sections associated
2738 with the @since tags.
2739
2740 -notree
2741 Omits the class/interface hierarchy pages from the generated
2742 documents. These are the pages you reach using the Tree button
2743 in the navigation bar. The hierarchy is produced by default.
2744
2745 -noindex
2746 Omits the index from the generated documents. The index is
2747 produced by default.
2748
2749 -nohelp
2750 Omits the HELP link in the navigation bars at the top and bottom
2751 of each page of output.
2752
2753 -nonavbar
2754 Prevents the generation of the navigation bar, header, and
2755 footer, that are usually found at the top and bottom of the
2756 generated pages. The -nonavbar option has no affect on the
2757 -bottom option. The -nonavbar option is useful when you are
2758 interested only in the content and have no need for navigation,
2759 such as when you are converting the files to PostScript or PDF
2760 for printing only.
2761
2762 -helpfile path\filename
2763 Specifies the path of an alternate help file path\filename that
2764 the HELP link in the top and bottom navigation bars link to.
2765 Without this option, the javadoc command creates a help file
2766 help-doc.html that is hard-coded in the javadoc command. This
2767 option lets you override the default. The file name can be any
2768 name and is not restricted to help-doc.html. The javadoc command
2769 adjusts the links in the navigation bar accordingly, for
2770 example:
2771
2772 javadoc -helpfile /home/user/myhelp.html java.awt.
2773
2774
2775
2776 -stylesheet path/filename
2777 Specifies the path of an alternate HTML stylesheet file. Without
2778 this option, the javadoc command automatically creates a
2779 stylesheet file stylesheet.css that is hard-coded in the javadoc
2780 command. This option lets you override the default. The file
2781 name can be any name and is not restricted to stylesheet.css,
2782 for example:
2783
2784 javadoc -stylesheet file /home/user/mystylesheet.css com.mypackage
2785
2786
2787
2788 -serialwarn
2789 Generates compile-time warnings for missing @serial tags. By
2790 default, Javadoc 1.2.2 and later versions generate no serial
2791 warnings. This is a reversal from earlier releases. Use this
2792 option to display the serial warnings, which helps to properly
2793 document default serializable fields and writeExternal methods.
2794
2795 -charset name
2796 Specifies the HTML character set for this document. The name
2797 should be a preferred MIME name as specified in the IANA
2798 Registry, Character Sets at
2799 http://www.iana.org/assignments/character-sets
2800
2801 For example, javadoc -charset "iso-8859-1" mypackage inserts the
2802 following line in the head of every generated page:
2803
2804 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
2805
2806
2807
2808 This META tag is described in the HTML standard (4197265 and
2809 4137321), HTML Document Representation, at
2810 http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2
2811
2812 See also the -encoding and -docencoding name options.
2813
2814 -docencoding name
2815 Specifies the encoding of the generated HTML files. The name
2816 should be a preferred MIME name as specified in the IANA
2817 Registry, Character Sets at
2818 http://www.iana.org/assignments/character-sets
2819
2820 If you omit the -docencoding option but use the -encoding
2821 option, then the encoding of the generated HTML files is
2822 determined by the -encoding option, for example: javadoc
2823 -docencoding "iso-8859-1" mypackage. See also the -encoding and
2824 -docencoding name options.
2825
2826 -keywords
2827 Adds HTML keyword <META> tags to the generated file for each
2828 class. These tags can help search engines that look for <META>
2829 tags find the pages. Most search engines that search the entire
2830 Internet do not look at <META> tags, because pages can misuse
2831 them. Search engines offered by companies that confine their
2832 searches to their own website can benefit by looking at <META>
2833 tags. The <META> tags include the fully qualified name of the
2834 class and the unqualified names of the fields and methods.
2835 Constructors are not included because they are identical to the
2836 class name. For example, the class String starts with these
2837 keywords:
2838
2839 <META NAME="keywords" CONTENT="java.lang.String class">
2840 <META NAME="keywords" CONTENT="CASE_INSENSITIVE_ORDER">
2841 <META NAME="keywords" CONTENT="length()">
2842 <META NAME="keywords" CONTENT="charAt()">
2843
2844
2845
2846 -tag tagname:Xaoptcmf:"taghead"
2847 Enables the javadoc command to interpret a simple, one-argument
2848 @tagname custom block tag in documentation comments. For the
2849 javadoc command to spell-check tag names, it is important to
2850 include a -tag option for every custom tag that is present in
2851 the source code, disabling (with X) those that are not being
2852 output in the current run.The colon (:) is always the separator.
2853 The -tag option outputs the tag heading taghead in bold,
2854 followed on the next line by the text from its single argument.
2855 Similar to any block tag, the argument text can contain inline
2856 tags, which are also interpreted. The output is similar to
2857 standard one-argument tags, such as the @return and @author
2858 tags. Omitting a value for taghead causes tagname to be the
2859 heading.
2860
2861 Placement of tags: The Xaoptcmf arguments determine where in the
2862 source code the tag is allowed to be placed, and whether the tag
2863 can be disabled (using X). You can supply either a, to allow the
2864 tag in all places, or any combination of the other letters:
2865
2866 X (disable tag)
2867
2868 a (all)
2869
2870 o (overview)
2871
2872 p (packages)
2873
2874 t (types, that is classes and interfaces)
2875
2876 c (constructors)
2877
2878 m (methods)
2879
2880 f (fields)
2881
2882 Examples of single tags: An example of a tag option for a tag
2883 that can be used anywhere in the source code is: -tag todo:a:"To
2884 Do:".
2885
2886 If you want the @todo tag to be used only with constructors,
2887 methods, and fields, then you use: -tag todo:cmf:"To Do:".
2888
2889 Notice the last colon (:) is not a parameter separator, but is
2890 part of the heading text. You would use either tag option for
2891 source code that contains the @todo tag, such as: @todo The
2892 documentation for this method needs work.
2893
2894 Colons in tag names: Use a backslash to escape a colon that you
2895 want to use in a tag name. Use the -tag ejb\\:bean:a:"EJB Bean:"
2896 option for the following documentation comment:
2897
2898 /**
2899 * @ejb:bean
2900 */
2901
2902
2903
2904 Spell-checking tag names: Some developers put custom tags in the
2905 source code that they do not always want to output. In these
2906 cases, it is important to list all tags that are in the source
2907 code, enabling the ones you want to output and disabling the
2908 ones you do not want to output. The presence of X disables the
2909 tag, while its absence enables the tag. This gives the javadoc
2910 command enough information to know whether a tag it encounters
2911 is unknown, which is probably the results of a typographical
2912 error or a misspelling. The javadoc command prints a warning in
2913 these cases. You can add X to the placement values already
2914 present, so that when you want to enable the tag, you can simply
2915 delete the X. For example, if the @todo tag is a tag that you
2916 want to suppress on output, then you would use: -tag
2917 todo:Xcmf:"To Do:". If you would rather keep it simple, then use
2918 this: -tag todo:X. The syntax -tag todo:X works even when the
2919 @todo tag is defined by a taglet.
2920
2921 Order of tags: The order of the -tag and -taglet options
2922 determines the order the tags are output. You can mix the custom
2923 tags with the standard tags to intersperse them. The tag options
2924 for standard tags are placeholders only for determining the
2925 order. They take only the standard tag's name. Subheadings for
2926 standard tags cannot be altered. This is illustrated in the
2927 following example.If the -tag option is missing, then the
2928 position of the -taglet option determines its order. If they are
2929 both present, then whichever appears last on the command line
2930 determines its order. This happens because the tags and taglets
2931 are processed in the order that they appear on the command line.
2932 For example, if the -taglet and -tag options have the name todo
2933 value, then the one that appears last on the command line
2934 determines the order.
2935
2936 Example of a complete set of tags: This example inserts To Do
2937 after Parameters and before Throws in the output. By using X, it
2938 also specifies that the @example tag might be encountered in the
2939 source code that should not be output during this run. If you
2940 use the @argfile tag, then you can put the tags on separate
2941 lines in an argument file similar to this (no line continuation
2942 characters needed):
2943
2944 -tag param
2945 -tag return
2946 -tag todo:a:"To Do:"
2947 -tag throws
2948 -tag see
2949 -tag example:X
2950
2951
2952
2953 When the javadoc command parses the documentation comments, any
2954 tag encountered that is neither a standard tag nor passed in
2955 with the -tag or -taglet options is considered unknown, and a
2956 warning is thrown.
2957
2958 The standard tags are initially stored internally in a list in
2959 their default order. Whenever the -tag options are used, those
2960 tags get appended to this list. Standard tags are moved from
2961 their default position. Therefore, if a -tag option is omitted
2962 for a standard tag, then it remains in its default position.
2963
2964 Avoiding conflicts: If you want to create your own namespace,
2965 then you can use a dot-separated naming convention similar to
2966 that used for packages: com.mycompany.todo. Oracle will continue
2967 to create standard tags whose names do not contain dots. Any tag
2968 you create will override the behavior of a tag by the same name
2969 defined by Oracle. If you create a @todo tag or taglet, then it
2970 always has the same behavior you define, even when Oracle later
2971 creates a standard tag of the same name.
2972
2973 Annotations vs. Javadoc tags: In general, if the markup you want
2974 to add is intended to affect or produce documentation, then it
2975 should be a Javadoc tag. Otherwise, it should be an annotation.
2976 See Custom Tags and Annotations in How to Write Doc Comments for
2977 the Javadoc Tool at
2978 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#annotations
2979
2980 You can also create more complex block tags or custom inline
2981 tags with the -taglet option.
2982
2983 -taglet class
2984 Specifies the class file that starts the taglet used in
2985 generating the documentation for that tag. Use the fully
2986 qualified name for the class value. This taglet also defines the
2987 number of text arguments that the custom tag has. The taglet
2988 accepts those arguments, processes them, and generates the
2989 output. For extensive documentation with example taglets, see:
2990 Taglet Overview at
2991 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/taglet/overview.html
2992
2993 Taglets are useful for block or inline tags. They can have any
2994 number of arguments and implement custom behavior, such as
2995 making text bold, formatting bullets, writing out the text to a
2996 file, or starting other processes. Taglets can only determine
2997 where a tag should appear and in what form. All other decisions
2998 are made by the doclet. A taglet cannot do things such as remove
2999 a class name from the list of included classes. However, it can
3000 execute side effects, such as printing the tag's text to a file
3001 or triggering another process. Use the -tagletpath option to
3002 specify the path to the taglet. The following example inserts
3003 the To Do taglet after Parameters and ahead of Throws in the
3004 generated pages. Alternately, you can use the -taglet option in
3005 place of its -tag option, but that might be difficult to read.
3006
3007 -taglet com.sun.tools.doclets.ToDoTaglet
3008 -tagletpath /home/taglets
3009 -tag return
3010 -tag param
3011 -tag todo
3012 -tag throws
3013 -tag see
3014
3015
3016
3017 -tagletpath tagletpathlist
3018 Specifies the search paths for finding taglet class files. The
3019 tagletpathlist can contain multiple paths by separating them
3020 with a colon (:). The javadoc command searches all
3021 subdirectories of the specified paths.
3022
3023 -docfilesubdirs
3024 Enables deep copying of doc-files directories. Subdirectories
3025 and all contents are recursively copied to the destination. For
3026 example, the directory doc-files/example/images and all of its
3027 contents would be copied. There is also an option to exclude
3028 subdirectories.
3029
3030 -excludedocfilessubdir name1:name2
3031 Excludes any doc-files subdirectories with the specified names.
3032 This prevents the copying of SCCS and other source-code-control
3033 subdirectories.
3034
3035 -noqualifier all | packagename1:packagename2...
3036 Omits qualifying package names from class names in output. The
3037 argument to the -noqualifier option is either all (all package
3038 qualifiers are omitted) or a colon-separate list of packages,
3039 with wild cards, to be removed as qualifiers. The package name
3040 is removed from places where class or interface names appear.
3041 See Process Source Files.
3042
3043 The following example omits all package qualifiers: -noqualifier
3044 all.
3045
3046 The following example omits java.lang and java.io package
3047 qualifiers: -noqualifier java.lang:java.io.
3048
3049 The following example omits package qualifiers starting with
3050 java, and com.sun subpackages, but not javax: -noqualifier
3051 java.*:com.sun.*.
3052
3053 Where a package qualifier would appear due to the previous
3054 behavior, the name can be suitably shortened. See How a Name
3055 Appears. This rule is in effect whether or not the -noqualifier
3056 option is used.
3057
3058 -notimestamp
3059 Suppresses the time stamp, which is hidden in an HTML comment in
3060 the generated HTML near the top of each page. The -notimestamp
3061 option is useful when you want to run the javadoc command on two
3062 source bases and get the differences between diff them, because
3063 it prevents time stamps from causing a diff (which would
3064 otherwise be a diff on every page). The time stamp includes the
3065 javadoc command release number, and currently appears similar to
3066 this: <!-- Generated by javadoc (build 1.5.0_01) on Thu Apr 02
3067 14:04:52 IST 2009 -->.
3068
3069 -nocomment
3070 Suppresses the entire comment body, including the main
3071 description and all tags, and generate only declarations. This
3072 option lets you reuse source files that were originally intended
3073 for a different purpose so that you can produce skeleton HTML
3074 documentation at the early stages of a new project.
3075
3076 -sourcetab tablength
3077 Specifies the number of spaces each tab uses in the source.
3078
3080 To shorten or simplify the javadoc command, you can specify one or more
3081 files that contain arguments to the javadoc command (except -J
3082 options). This enables you to create javadoc commands of any length on
3083 any operating system.
3084
3085 An argument file can include javac options and source file names in any
3086 combination. The arguments within a file can be space-separated or
3087 newline-separated. If a file name contains embedded spaces, then put
3088 the whole file name in double quotation marks.
3089
3090 File Names within an argument file are relative to the current
3091 directory, not the location of the argument file. Wild cards (*) are
3092 not allowed in these lists (such as for specifying *.java). Using the
3093 at sign (@) to recursively interpret files is not supported. The -J
3094 options are not supported because they are passed to the launcher,
3095 which does not support argument files.
3096
3097 When you run the javadoc command, pass in the path and name of each
3098 argument file with the @ leading character. When the javadoc command
3099 encounters an argument beginning with the at sign (@), it expands the
3100 contents of that file into the argument list.
3101
3102 Example 1 Single Argument File
3103
3104 You could use a single argument file named argfile to hold all javadoc
3105 command arguments: javadoc @argfile. The argument file contains the
3106 contents of both files, as shown in the next example.
3107
3108 Example 2 Two Argument Files
3109
3110 You can create two argument files: One for the javadoc command options
3111 and the other for the package names or source file names. Notice the
3112 following lists have no line-continuation characters.
3113
3114 Create a file named options that contains:
3115
3116 -d docs-filelist
3117 -use
3118 -splitindex
3119 -windowtitle 'Java SE 7 API Specification'
3120 -doctitle 'Java SE 7 API Specification'
3121 -header '<b>Java™ SE 7</b>'
3122 -bottom 'Copyright © 1993-2011 Oracle and/or its affiliates. All rights reserved.'
3123 -group "Core Packages" "java.*"
3124 -overview /java/pubs/ws/1.7.0/src/share/classes/overview-core.html
3125 -sourcepath /java/pubs/ws/1.7.0/src/share/classes
3126
3127 Create a file named packages that contains:
3128
3129 com.mypackage1
3130 com.mypackage2
3131 com.mypackage3
3132
3133 Run the javadoc command as follows:
3134
3135 javadoc @options @packages
3136
3137 Example 3 Argument Files with Paths
3138
3139 The argument files can have paths, but any file names inside the files
3140 are relative to the current working directory (not path1 or path2):
3141
3142 javadoc @path1/options @path2/packages
3143
3144 Example 4 Option Arguments
3145
3146 The following example saves an argument to a javadoc command option in
3147 an argument file. The -bottom option is used because it can have a
3148 lengthy argument. You could create a file named bottom to contain the
3149 text argument:
3150
3151 <font size="-1">
3152 <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a><br/>
3153 Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved. <br/>
3154 Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
3155 Other names may be trademarks of their respective owners.</font>
3156
3157 Run the javadoc command as follows:javadoc -bottom @bottom @packages.
3158
3159 You can also include the -bottom option at the start of the argument
3160 file and run the javadoc command as follows: javadoc @bottom @packages.
3161
3163 The release number of the javadoc command can be determined with the
3164 javadoc -J-version option. The release number of the standard doclet
3165 appears in the output stream. It can be turned off with the -quiet
3166 option.
3167
3168 Use the public programmatic interface to call the javadoc command from
3169 within programs written in the Java language. This interface is in
3170 com.sun.tools.javadoc.Main (and the javadoc command is reentrant). For
3171 more information, see The Standard Doclet at
3172 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/standard-
3173 doclet.html#runningprogrammatically
3174
3175 The following instructions call the standard HTML doclet. To call a
3176 custom doclet, use the -doclet and -docletpath options. See Doclet
3177 Overview at
3178 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/doclet/overview.html
3179
3180 SIMPLE EXAMPLES
3181 You can run the javadoc command on entire packages or individual source
3182 files. Each package name has a corresponding directory name.
3183
3184 In the following examples, the source files are located at
3185 /home/src/java/awt/*.java. The destination directory is /home/html.
3186
3187 Document One or More Packages
3188
3189 To document a package, the source files for that package must be
3190 located in a directory that has the same name as the package.
3191
3192 If a package name has several identifiers (separated by dots, such as
3193 java.awt.color), then each subsequent identifier must correspond to a
3194 deeper subdirectory (such as java/awt/color).
3195
3196 You can split the source files for a single package among two such
3197 directory trees located at different places, as long as -sourcepath
3198 points to them both. For example, src1/java/awt/color and
3199 src2/java/awt/color.
3200
3201 You can run the javadoc command either by changing directories (with
3202 the cd command) or by using the -sourcepath option. The following
3203 examples illustrate both alternatives.
3204
3205 Example 1 Recursive Run from One or More Packages
3206
3207 This example uses -sourcepath so the javadoc command can be run from
3208 any directory and -subpackages (a new 1.4 option) for recursion. It
3209 traverses the subpackages of the java directory excluding packages
3210 rooted at java.net and java.lang. Notice this excludes java.lang.ref, a
3211 subpackage of java.lang. To also traverse down other package trees,
3212 append their names to the -subpackages argument, such as
3213 java:javax:org.xml.sax.
3214
3215 javadoc -d /home/html -sourcepath /home/src -subpackages java -exclude
3216
3217 Example 2 Change to Root and Run Explicit Packages
3218
3219 Change to the parent directory of the fully qualified package. Then,
3220 run the javadoc command with the names of one or more packages that you
3221 want to document:
3222
3223 cd /home/src/
3224 javadoc -d /home/html java.awt java.awt.event
3225
3226 To also traverse down other package trees, append their names to the
3227 -subpackages argument, such as java:javax:org.xml.sax.
3228
3229 Example 3 Run from Any Directory on Explicit Packages in One Tree
3230
3231 In this case, it does not matter what the current directory is. Run the
3232 javadoc command and use the -sourcepath option with the parent
3233 directory of the top-level package. Provide the names of one or more
3234 packages that you want to document:
3235
3236 javadoc -d /home/html -sourcepath /home/src java.awt java.awt.event
3237
3238 Example 4 Run from Any Directory on Explicit Packages in Multiple Trees
3239
3240 Run the javadoc command and use the -sourcepath option with a colon-
3241 separated list of the paths to each tree's root. Provide the names of
3242 one or more packages that you want to document. All source files for a
3243 specified package do not need to be located under a single root
3244 directory, but they must be found somewhere along the source path.
3245
3246 javadoc -d /home/html -sourcepath /home/src1:/home/src2 java.awt java.awt.event
3247
3248 The result is that all cases generate HTML-formatted documentation for
3249 the public and protected classes and interfaces in packages java.awt
3250 and java.awt.event and save the HTML files in the specified destination
3251 directory. Because two or more packages are being generated, the
3252 document has three HTML frames: one for the list of packages, another
3253 for the list of classes, and the third for the main class pages.
3254
3255 Document One or More Classes
3256
3257 The second way to run the javadoc command is to pass one or more source
3258 files. You can run javadoc either of the following two ways: by
3259 changing directories (with the cd command) or by fully specifying the
3260 path to the source files. Relative paths are relative to the current
3261 directory. The -sourcepath option is ignored when passing source files.
3262 You can use command-line wild cards, such as an asterisk (*), to
3263 specify groups of classes.
3264
3265 Example 1 Change to the Source Directory
3266
3267 Change to the directory that holds the source files. Then run the
3268 javadoc command with the names of one or more source files you want to
3269 document.
3270
3271 This example generates HTML-formatted documentation for the classes
3272 Button, Canvas, and classes that begin with Graphics. Because source
3273 files rather than package names were passed in as arguments to the
3274 javadoc command, the document has two frames: one for the list of
3275 classes and the other for the main page.
3276
3277 cd /home/src/java/awt
3278 javadoc -d /home/html Button.java Canvas.java Graphics*.java
3279
3280 Example 2 Change to the Root Directory of the Package
3281
3282 This is useful for documenting individual source files from different
3283 subpackages off of the same root. Change to the package root directory,
3284 and supply the source files with paths from the root.
3285
3286 cd /home/src/
3287 javadoc -d /home/html java/awt/Button.java java/applet/Applet.java
3288
3289 Example 3 Document Files from Any Directory
3290
3291 In this case, it does not matter what the current directory is. Run the
3292 javadoc command with the absolute path (or path relative to the current
3293 directory) to the source files you want to document.
3294
3295 javadoc -d /home/html /home/src/java/awt/Button.java
3296 /home/src/java/awt/Graphics*.java
3297
3298
3299
3300 Document Packages and Classes
3301
3302 You can document entire packages and individual classes at the same
3303 time. Here is an example that mixes two of the previous examples. You
3304 can use the -sourcepath option for the path to the packages but not for
3305 the path to the individual classes.
3306
3307 javadoc -d /home/html -sourcepath /home/src java.awt
3308 /home/src/java/applet/Applet.java
3309
3310
3311 REAL-WORLD EXAMPLES
3312 The following command-line and makefile versions of the javadoc command
3313 run on the Java platform APIs. It uses 180 MB of memory to generate the
3314 documentation for the 1500 (approximately) public and protected classes
3315 in the Java SE 1.2. Both examples use absolute paths in the option
3316 arguments, so that the same javadoc command can be run from any
3317 directory.
3318
3319 Command-Line Example
3320
3321 The following command might be too long for some shells. You can use a
3322 command-line argument file (or write a shell script) to overcome this
3323 limitation.
3324
3325 In the example, packages is the name of a file that contains the
3326 packages to process, such as java.appletjava.lang. None of the options
3327 should contain any newline characters between the single quotation
3328 marks. For example, if you copy and paste this example, then delete the
3329 newline characters from the -bottom option.
3330
3331 javadoc -sourcepath /java/jdk/src/share/classes \
3332 -overview /java/jdk/src/share/classes/overview.html \
3333 -d /java/jdk/build/api \
3334 -use \
3335 -splitIndex \
3336 -windowtitle 'Java Platform, Standard Edition 7 API Specification' \
3337 -doctitle 'Java Platform, Standard Edition 7 API Specification' \
3338 -header '<b>Java™ SE 7</b>' \
3339 -bottom '<font size="-1">
3340 <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a><br/>
3341 Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.<br/>
3342 Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
3343 Other names may be trademarks of their respective owners.</font>' \
3344 -group "Core Packages" "java.*:com.sun.java.*:org.omg.*" \
3345 -group "Extension Packages" "javax.*" \
3346 -J-Xmx180m \
3347 @packages
3348
3349
3350
3351 Programmatic Interface
3352
3353 The Javadoc Access API enables the user to invoke the Javadoc tool
3354 directly from a Java application without executing a new process.
3355
3356 For example, the following statements are equivalent to the command
3357 javadoc -d /home/html -sourcepath /home/src -subpackages java -exclude
3358 java.net:java.lang com.example:
3359
3360 import javax.tools.DocumentationTool;
3361 import javax.tools.ToolProvider;
3362 public class JavaAccessSample{
3363 public static void main(String[] args){
3364 DocumentationTool javadoc = ToolProvider.getSystemDocumentationTool();
3365 int rc = javadoc.run( null, null, null,
3366 "-d", "/home/html",
3367 "-sourcepath", "home/src",
3368 "-subpackages", "java",
3369 "-exclude", "java.net:java.lang",
3370 "com.example");
3371 }
3372 }
3373
3374 The first three arguments of the run method specify input, standard
3375 output, and standard error streams. Null is the default value for
3376 System.in, System.out, and System.err, respectively.
3377
3378 THE MAKEFILE EXAMPLE
3379 This is an example of a GNU makefile. Single quotation marks surround
3380 makefile arguments. For an example of a Windows makefile, see the
3381 makefiles section of the Javadoc FAQ at
3382 http://www.oracle.com/technetwork/java/javase/documentation/index-137483.html#makefiles
3383
3384 javadoc -sourcepath $(SRCDIR) \ /* Sets path for source files */
3385 -overview $(SRCDIR)/overview.html \ /* Sets file for overview text */
3386 -d /java/jdk/build/api \ /* Sets destination directory */
3387 -use \ /* Adds "Use" files */
3388 -splitIndex \ /* Splits index A-Z */
3389 -windowtitle $(WINDOWTITLE) \ /* Adds a window title */
3390 -doctitle $(DOCTITLE) \ /* Adds a doc title */
3391 -header $(HEADER) \ /* Adds running header text */
3392 -bottom $(BOTTOM) \ /* Adds text at bottom */
3393 -group $(GROUPCORE) \ /* 1st subhead on overview page */
3394 -group $(GROUPEXT) \ /* 2nd subhead on overview page */
3395 -J-Xmx180m \ /* Sets memory to 180MB */
3396 java.lang java.lang.reflect \ /* Sets packages to document */
3397 java.util java.io java.net \
3398 java.applet
3399 WINDOWTITLE = 'Java™ SE 7 API Specification'
3400 DOCTITLE = 'Java™ Platform Standard Edition 7 API Specification'
3401 HEADER = '<b>Java™ SE 7</font>'
3402 BOTTOM = '<font size="-1">
3403 <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a><br/>
3404 Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.<br/>
3405 Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
3406 Other names may be trademarks of their respective owners.</font>'
3407 GROUPCORE = '"Core Packages" "java.*:com.sun.java.*:org.omg.*"'
3408 GROUPEXT = '"Extension Packages" "javax.*"'
3409 SRCDIR = '/java/jdk/1.7.0/src/share/classes'
3410
3411
3412 NOTES
3413 · If you omit the -windowtitle option, then the javadoc command copies
3414 the document title to the window title. The -windowtitle option text
3415 is similar to the the -doctitle option, but without HTML tags to
3416 prevent those tags from appearing as raw text in the window title.
3417
3418 · If you omit the -footer option, then the javadoc command copies the
3419 header text to the footer.
3420
3421 · Other important options you might want to use, but were not needed in
3422 the previous example, are the -classpath and -link options.
3423
3425 · The javadoc command reads only files that contain valid class names.
3426 If the javadoc command is not correctly reading the contents of a
3427 file, then verify that the class names are valid. See Process Source
3428 Files.
3429
3430 · See the Javadoc FAQ for information about common bugs and for
3431 troubleshooting tips at
3432 http://www.oracle.com/technetwork/java/javase/documentation/index-137483.html
3433
3435 Error and warning messages contain the file name and line number to the
3436 declaration line rather than to the particular line in the
3437 documentation comment.
3438
3439 For example, this message error: cannot read: Class1.java means that
3440 the javadoc command is trying to load Class1.java in the current
3441 directory. The class name is shown with its path (absolute or
3442 relative).
3443
3445 CLASSPATH
3446 CLASSPATH is the environment variable that provides the path
3447 that the javadoc command uses to find user class files. This
3448 environment variable is overridden by the -classpath option.
3449 Separate directories with a semicolon for Windows or a colon for
3450 Oracle Solaris.
3451
3452 Windows example: .;C:\classes;C:\home\java\classes
3453
3454 Oracle Solaris example: .:/home/classes:/usr/local/java/classes.
3455
3457 · javac(1)
3458
3459 · java(1)
3460
3461 · jdb(1)
3462
3463 · javap(1)
3464
3466 · Javadoc Technology at
3467 http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/index.html
3468
3469 · How Classes Are Found
3470 http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html
3471
3472 · How to Write Doc Comments for the Javadoc Tool
3473 http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html
3474
3475 · URL Memo, Uniform Resource Locators
3476 http://www.ietf.org/rfc/rfc1738.txt
3477
3478 · HTML standard, HTML Document Representation (4197265 and 4137321)
3479 http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2
3480
3481
3482
3483JDK 8 03 March 2015 javadoc(1)