How to write javadoc links?

后端 未结 3 1289
礼貌的吻别
礼貌的吻别 2021-02-02 06:22

How do I write links into javadocs?

Currently, I have something like:

{@link java.lang.Math#sqrt(double) Math.sqrt}

to produce the text

3条回答
  •  我在风中等你
    2021-02-02 07:00

    My answer is very much provided by Eddie, but his exact code doesn't work for me (or at least when using the version of javadoc that comes with Java 1.6)

    If I do:

        javadoc -linkoffline http://java.sun.com/javase/6/docs/api/ 
                             http://java.sun.com/javase/6/docs/api/package-list
                -public FileName.java

    then javadoc complains:

        javadoc: warning - Error fetching URL: 
        http://java.sun.com/javase/6/docs/api/package-list/package-list

    If, on the other hand, I do:

        javadoc -linkoffline http://java.sun.com/javase/6/docs/api/ 
                             http://java.sun.com/javase/6/docs/api/ 
                -public FileName.java

    Then it works, and my links are populated as I want them to be.

    Additionally, my link isn't malformed. The text {@link java.lang.Math#sqrt(double) Math.sqrt} produces the link text Math.sqrt instead of the default Math.sqrt(double).

提交回复
热议问题