TomSelleck
TomSelleck

Reputation: 6968

Javadoc multiple packages

I am trying to generate java documentation for multiple packages so I have a single index.html, I can generate them fine for single packages by writing,

 javadoc packages/mypackage1/program/*.java

but I can't get it to work for multiple packages. I tried using javadoc @packages but I get

error - cannot read packages <access is denied>

Any ideas would be great!!

Upvotes: 5

Views: 4846

Answers (2)

Rudy Vissers
Rudy Vissers

Reputation: 5477

Let's give an example:

The following command line will process all the packages under com and LOR (lord of the rings) located into /home/rudy/IdeaProjects/demo/src/main/java and /home/rudy/IdeaProjects/demo/src/test/java/

Please note:

  • it is Linux and the paths and packages are separated by ':'.
    (on Windows, separated by ';').
  • that I made usage of private and wanted all the classes and members to be documented.

rudy@rudy-ThinkPad-T590:~$ javadoc -d /home/rudy/IdeaProjects/demo_doc
-sourcepath /home/rudy/IdeaProjects/demo/src/main/java/
:/home/rudy/IdeaProjects/demo/src/test/java/
-subpackages com:LOR 
-private

rudy@rudy-ThinkPad-T590:~/IdeaProjects/demo/src/main/java$ ls -R 
.: com LOR
./com: example
./com/example: demo
./com/example/demo: DemowApplication.java
./LOR: Race.java TolkienCharacter.java

rudy@rudy-ThinkPad-T590:~/IdeaProjects/demo/src/test/java$ ls -R 
.: com
./com: example
./com/example: demo
./com/example/demo: AssertJTest.java DemowApplicationTests.java

Upvotes: 1

laurent kubaski
laurent kubaski

Reputation: 304

javadoc -d [DESTINATION_FOLDER] -sourcepath [SOURCE_FOLDER] -subpackages [PACKAGE1]:[PACKAGE2]

For example, if your hierarchy is:

  • /home/my_project/src/com/foo/Class1.java
  • /home/my_project/src/fr/foo/Class2.java

Then your command line will look like:

javadoc -d [DESTINATION_FOLDER] -sourcepath /home/my_project/src -subpackages com:fr

Upvotes: 7

Related Questions