This article is participating in the Java Theme Month – Java Debug Notes Event, see the event link for details

The problem

How do you link external urls in Javadoc? Similar to:

/**
 * See {@linktourl http://google.com}
 */
Copy the code

answer

Answer 1

Using the above method, a link called See Also title will be created, that is:

/ * * *@see <a href="http://google.com">http://google.com</a>
 */
Copy the code

The message is:

See Also:

google.com

An inline link will be created using the following method:

/** * See http://google.com */
Copy the code

The message is:

See:google.com

Answer 2

@see label : Adds a link defined by URL#value, which is a relative or absolute URL address. The Javadoc tool distinguishes this case by looking for the less-than symbol < as the first character, such as:

@see <a href="http://www.google.com">Google</a>
Copy the code

Answer 3

The Javadoc tools don’t provide any special tools for external links, so we need to use standard HTML, which can be used in one of two ways:

See <a href="http://groversmill.com/">Grover's Mill</a> for a history of the
Martian invasion.
Copy the code
@see <a href="http://groversmill.com/">Grover's Mill for a history of the Martian invasion.Copy the code

Do not use {@link… } or {@linkplain… }, because both connections point to Javadoc for other classes and methods.

Answer 4

In Oracle’s website is difficult to find a clear answer, the following explanation to javax.mail. Ws. Rs. Core. HttpHeaders. Java.

/**
 * See {@link< a href = "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1" > HTTP / 1.1 documentation < / a >}. * /
public static final String ACCEPT = "Accept";

/**
 * See {@link< a href = "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2" > HTTP / 1.1 documentation < / a >}. * /
public static final String ACCEPT_CHARSET = "Accept-Charset";
Copy the code

provenance

Linking to an External URL in Javadoc?