Search code examples
javaimagejavadoc

Including images in javadocs


I work with a lot of sample test cases that are visual. Is there any convenient way to include them in my Java source and link them in Javadocs, so my IDE can automatically show them while coding (by invoking a javadoc renderer feature in my IDE?)

I tried putting an image next to the Java source and using <img>, but it's not taking (I used a png).

(note - it's in my test sources in this case)


Solution

  • As you didn't show any sources, I can only do a glass-ball guess ...

    For any files which are needed for documentation purposes, one should put them in a subdirectory named doc-files of your package directories. These will then be simply copied by Javadoc to the output directory. Then use a relative path in the <img> element.

    I'm not sure if your IDE's Javadoc renderer will do the same, but it is worth a try.