0

I am unable to generate javadoc for linked .java files using Eclipse Mars.

This shows how my project is set up: Eclipse view

I am able to run the program.

The source file is in a folder named foo, to match the package declaration:

Directory Ellen > Google Drive > 64 2016 > src > foo

I select Project > Generate Javadoc... and check the package:

enter image description here

I agree to all of the default options.

I get this output in the console:

Loading source files for package foo...
Constructing Javadoc information...
javadoc: warning - No source files for package foo
javadoc: warning - No source files for package foo
javadoc: error - No public or protected classes found to document.
1 error
2 warnings

Adding javadoc comments to the source code makes no difference.

I have no trouble generating javadoc when I do not have linked source files.

How do I set up links to source files so I can generate javadoc?

Ellen Spertus
  • 6,576
  • 9
  • 50
  • 101

1 Answers1

1

When you do Project > Generate Javadoc... it launches the external program javadoc part of the JDK typically. The javadoc program does not understand/know about Eclipse linked resources, so it sees the empty folder.

How do I set up links to source files so I can generate javadoc?

Short answer is you cannot with links at the file level.

Use Links to src folder

Rather than doing a link to files within a package, make the link to the containing source folder. In your screenshot you don't have a src folder, but you could create one that is linked.

For example, I have a project called demoforso, in it I create a folder called src that is linked to D:\tmp\src and add src to classpath. When the javadoc is run on this project, it passes D:\tmp\src as the sourcepath.

Use Javadoc views in Eclipse

(i.e. Don't generate Javadoc at all, granted possibly not useful in your case, but included for completeness.)

The hovers and Javadoc view in Eclipse means that you never need to generated Javadoc for your own use.

Jonah Graham
  • 7,890
  • 23
  • 55
  • Thanks so much for the helpful response. I'll give it a try when I get home. – Ellen Spertus Feb 16 '16 at 21:47
  • I'm having trouble figuring out how to link an entire src folder. Any pointers? – Ellen Spertus Feb 16 '16 at 22:04
  • Actually, I got it working by creating a new project with separate folders for src and class files, then dragging in the src file, selecting the option "Link to files and recreate folder structure with virtual folders", and overwriting the existing src directory. The display of packages is a little awkward but works. – Ellen Spertus Feb 16 '16 at 22:10