5

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!!

2 Answers 2

7

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

Sign up to request clarification or add additional context in comments.

Comments

1

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 

1 Comment

Nice answer with example. I'll just add that with Windows you need to add a ";" for the separator for multiple source paths

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.