Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding images into source code

Is there a way (or an editor) that allows me to link an image/files/http links from within a source file (*.java for instance), sort of like a rich text document?

This way, while reading the code I can quickly look at the appended image (augmenting the comments), instead of opening the browser etc.

like image 666
Lydon Ch Avatar asked May 25 '10 08:05

Lydon Ch


2 Answers

Javadocs are HTML, so you can just embed images there:

/**
 * This class does some funky stuff (see diagram).
 * <img src="relative/path/to/your/image.png" />
 * 
 */
 public class FunkyClass{
 }

Eclipse will happily show you the images in the javadoc view or on hovering over the comment. Other IDEs might or might not do the same.

Obviously you have to make sure somehow that the images are deployed with the javadocs...

like image 163
Sean Patrick Floyd Avatar answered Sep 19 '22 01:09

Sean Patrick Floyd


As many says you can use but for example in Eclipse you encouter error if you don't declare "alt" and if you use "selfclosing" tag like

<img alt="image desc" src="path/img.jpg">

seems not givin error =)

like image 32
Andrea Bori Avatar answered Sep 21 '22 01:09

Andrea Bori