javadoc.htm
Last updated: Wednesday 19th September 2007, 6:10 PT
by AHD
How to
use javadoc.exe
----------------------
To help
with the understanding of any new class you create, you
should
always comment your java code for javadoc.exe,
following
the style in SavitchIn.java (and see below).
See:
p100-101,268,931,1034-1035 4th Ed and p1013 for
SavitchIn.java
p916-917,3rd Ed and p895 for SavitchIn.java
p1020-1022 2nd Ed and p993 for SavitchIn.java
p707 1st
Ed and p693 for SavitchIn.java
Textbook:
"Java - An Introduction to Computer Science and
Programming"
by
Walter Savitch
Textbook: "Java - An Introduction to Problem
Solving & Programming", 4th Ed, Walter Savitch
ISBN 0-13-149202-0
To comment your java files for javadoc:
At the top of your source code,
provide a comment block which starts
with the characters
/**
and ends with the characters
*/
For an example of a class and its
javadoc html page:
Click here.
Q&A
Question: What parts of a java class
does javadoc create documentation for?
Answer: the set of heading lines
of public methods
i.e. the headers of the public
method definitions
as well as the heading of the
class itself
and any public variables.
See Display 4.11 on page 264 of
4th Ed -
the highlighted parts of the code
are extracted by javadoc.
The set of public method headings
makes up what is known as
the interface or the behaviour
of the class - i.e. its functional abstraction.
Only public classes, methods and
instance variables are documented by javadoc.
Question: What does a javadoc web
page look like?
Answer: For an example of a class and
its javadoc html page click here.
Question: How do I run javadoc?
Answer: To run javadoc, assuming the Java SDK is
located here:
C:\j2sdk1.4.2_01
and
assuming the Temperature.java file is in C:\temp
Click on
the Start button on the desktop
Select
Run
Browse
for this file:
C:\j2sdk1.4.2_01\bin\javadoc.exe
and in the
Run textbox add the text exactly as here:
C:\j2sdk1.4.2_01\bin\javadoc.exe -d C:\temp C:\temp\Temperature.java
and click
on OK to run.
********************************************************************************
IMPORTANT
NOTE: if you installed java to the Program Files folder,
for
"Program Files" substitute "Progra~1" in the path, e.g.:
C:\Progra~1\Java\jdk1.6.0_02\bin\javadoc.exe -d c:\temp
C:\temp\Temperature.java
********************************************************************************
The
"-d c:\temp" is a javadoc flag specifying that the destination
folder to
write the html documentation files to, is C:\temp
When you
supply a .java file name to javadoc, you must give the full path,
e.g.
C:\temp\Temperature.java
Reference
Textbook:
"Java - An Introduction to Problem Solving &
Programming",
4th Ed,
Walter
Savitch
ISBN 0-13-149202-0
----0000000----