Suzan Cioc
Suzan Cioc

Reputation: 30097

How to compile javadoc from sources in simplest way?

Suppose I have project directory MyProject, under which I have src directory with sources of the program.

I want to compile all javadocs from there. What is the simplest command to issue?

If I run

javadoc -sourcepath ./src -d ./docs

I get an error

javadoc: error - No packages or classes specified.

Can't it deduce packages from source files?

EDIT 1

This way also causes an error

...MyProject>javadoc -sourcepath ./src *.java -d ./docs
Creating destination directory: "./docs\"
javadoc: error - File not found: "*.java"
1 error

Upvotes: 32

Views: 30863

Answers (6)

kholofelo Maloma
kholofelo Maloma

Reputation: 1003

In linux, it worked for me when I did the following

javadoc -d docs/ $(find . -name *.java)

I hope this helps

Upvotes: 10

derwiwie
derwiwie

Reputation: 905

For me also the following worked:

javadoc -sourcepath ./src **/*.java -d ./docs

Upvotes: 0

Suzan Cioc
Suzan Cioc

Reputation: 30097

The following worked for me

javadoc -sourcepath ./src -d ./docs -subpackages .

Upvotes: 24

cl-r
cl-r

Reputation: 1264

The lazy way is to use Eclipse : Project --> GenerateJavadoc and choose the package/project you want to document.

Upvotes: 3

Dunes
Dunes

Reputation: 40703

The man page says it will only explicitly document packages that it is given. There is an option called subpackages that recursively documents the given package and all it subpackages, but you must still specify all base packages.

eg.

javadoc -d /home/html -sourcepath /home/src -subpackages java -exclude java.net:java.lang

http://www.manpagez.com/man/1/javadoc/

Upvotes: 11

Rahul Borkar
Rahul Borkar

Reputation: 2762

try using javadoc -sourcepath ./src *.java -d ./docs

Upvotes: 3

Related Questions