Search code examples
androidjavadoc

Is it possible to link README file in javadocs?


I currently use my README file as a set of instructions, and would like to refer to it in javadocs. I know it is possible to link directories in javadoc, for example to link an image I can do

/**
 * <img src="../../../images/Diagram.png"/>
 */

But how to link the README file that is under the project root? Is it possible?


Solution

  • Based on the AdoptOpenJDK Collection source code, it looks like the HTML anchor <a></a> tag is used to link to files in various parts. For example on lines 192-193, there's:

    <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
    Java Collections Framework</a>.
    

    You can also see this in other javadoc comments throughout the source code as well so you should be able to use the path to the non-Java class file you want to link to with the anchor tag.