How can I include images in my javadoc comments so they appear properly in the javadoc output?

Andre van Dalen

As of javadoc 1.2 you can provide the images you want to include in your javadoc generated documentation in a sub-directory in the source tree of your package which must be named doc-files if javadoc encounters such a directory it will copy its contents into the javadoc tree it generates. (Note: this doesn't seem to work for classes that are not in a package situated directly in the root of your source tree.)

The images you want to include are stored in the doc-files directories and referenced in your doc-comments as follows:

 * SuperDuper class, does everything you need.
 * <p><IMG SRC="doc-files/point.gif">
 * It even draws points!
 * @see OtherClass <IMG SRC="doc-files/ref.gif">
 * @since	today

The first IMG tag simply inserts an image in the documentation, the second IMG tag replaces the normal text hyperlink with an image hyperlink.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact