This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have doenloaded SDK 5. I am on windows. I am trying to run javadoc from cmdline. So far I have been able to document a single main .java file. Now I want also to document all the packages in the subdirectories of my program. In the example showen on the sun website, they only show how to create documents of the standard library of java. So basically I want it to document my whole program. The "main" java file and all the packages. Everything in my src. How do I do this? Thanks in advance.

##### Share on other sites

also here is the documentation in the api for this -- but you should really read the api about the javadoc tool, there is likely to be a better and easier way...and then after that start using Ant (at apache.org), it will help (but its not the answer for everything.)

SIMPLE EXAMPLESYou can run javadoc on entire packages or individual source files. Each packagename has a corresponding directory name. In the following examples, the sourcefiles are located at C:\home\src\java\awt\*java. The destination directory isC:\home\html.Documenting One or More PackagesTo document a package, the source files (*.java) for that package must belocated in a directory having the same name as the package. If a package nameis made up of several identifiers (separated by dots, such as java.awt.color),each subsequent identifier must correspond to a deeper subdirectory (such asjava/awt/color). You may split the source files for a single package among twosuch directory trees located at different places, as long as -sourcepath pointsto them both -- for example src1\java\awt\color and src2\java\awt\color.You can run javadoc either by changing directories (with cd) or by using -sourcepath option. The examples below illustrate both alternatives.Case 1 - Run recursively starting from one or more packages - This exampleuses -sourcepath so javadoc can be run from any directory and -subpackages (anew 1.4 option) for recursion. It traverses the subpackages of the javadirectory excluding packages rooted at java.net and java.lang. Notice thisexcludes java.lang.ref, a subpackage of java.lang).% javadoc -d \home\html -sourcepath \home\src -subpackages java -excludejava.net:java.langTo also traverse down other package trees, append their names to the -subpackages argument, such as java:javax:org.xml.sax.Case 2 - Run on explicit packages after changing to the "root" sourcedirectory - Change to the parent directory of the fully-qualified package. Thenrun javadoc, supplying names of one or more packages you want to document:  C:> cd C:\home\src  C:> javadoc -d C:\home\html java.awt java.awt.eventCase 3 - Run from any directory on explicit packages in a single directorytree - In this case, it doesn't matter what the current directory is. Runjavadoc supplying -sourcepath with the parent directory of the top-levelpackage, and supplying names of one or more packages you want to document:  C:> javadoc -d C:\home\html -sourcepath C:\home\src java.awt java.awt.eventCase 4 - Run from any directory on explicit packages in multiple directorytrees - This is the same as case 3, but for packages in separate directorytrees. Run javadoc supplying -sourcepath with the path to each tree's root(colon-separated) and supply names of one or more packages you want todocument. All source files for a given package do not need to be located undera single root directory -- they just need to be found somewhere along thesourcepath.  C:> javadoc -d C:\home\html -sourcepath C:\home\src1;C:\home\src2 java.awtjava.awt.eventResult: All cases generate HTML-formatted documentation for the public andprotected classes and interfaces in packages java.awt and java.awt.event andsave the HTML files in the specified destination directory (C:\home\html).Because two or more packages are being generated, the document has three HTMLframes -- for the list of packages, the list of classes, and the main classpages.

L-

##### Share on other sites
It finds the directory structure, but for some reason it doesnt find any file in it:

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 13
• 38
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631714
• Total Posts
3001861
×