Introduction to Programming

toaststicksrifleSoftware and s/w Development

Aug 15, 2012 (5 years and 1 day ago)

185 views

Computer
Programming
I and II






Instructor: Greg Shaw

COP 2210 and 3337







Using the
javadoc

Utility

in NetBeans



The
javadoc

utility program is used to generate HTML "help" pages for
java files

that have been properly documented
wi
th

Java
documentation
comments.

(See "
Java D
ocumentation

Comments
"

online
).


The
se

web
pages will have the same format as the official Java Language
Documentation from Sun Microsystems.



I.

Generating
javadoc “
Help


Pages for Your
Java Files




To generate h
elp pages for all java files in a project, just open
the project and choose “
Generate Javadoc
(
project
-
name
)”

from the
Run

menu




This will create
many files,
all
stored in
a folder named
j
avadoc
,

located
in the
dist

folder in your project folder





The
doc
umentation for each Java file will be a file with the
same
name
but with an extension of
html
.

E.g.

the documentation file
for
Hello.java

would be
Hello.html




I
f your
Java

file contains m
ore than one class definition
, the
HTML file will document only the
public

class (i.e., the class
with the same name as the
Java

file). Therefor,
to create
documentation for multiple classes
,

each class
must be stored
in a
separate file, and designate
d

as
public



A
s of version 7.0
,

NetBeans will no longer generate
javadoc

for
classes in the
default package

(i.e. the src folder). To learn
how to create and use your own packages, see

the “
Packages


document,

online



II.


Quick Way to View the
javadoc

Pages in NetBeans




In the
Files

pane, right
-
click on the icon for the .html fi
le and
choose
View
,
or




In the
Source Editor

window,
right
-
click and choose
View Javadoc

(or

click in the class name and press
[Alt]+[F1]
)



(Either of these will open the
HTML file in your default browser
)


To view the javadoc pages outside of NetBeans, c
hoose
Open…

or
Open
File…

from the
File

menu of your browser and navigate to find the
file. Or, navigate to find the file and then double
-
click the file
icon to open it in your default browser.