Javadoc Link external URL | Java Documentation example

This tutorial explains how to link external URLs in java documentation comments with examples.

@linktag in java used to create a hypherlink pointing to other method(classes) documentation blocks

If you want to link external URLS, You need to add anchor links using @see inside java documentation.

@see tag used with anchor tag to link external site. you can use one of the anchor tags to link an external domain or URL.

/**
 * See <a href="http://google.com" >here</a>
 */

or

/**
 * @see <a href="http://www.google.com">Here</a>
 */

You can also add target="_top" to the anchor tag to replace and load external URLs on a separate browser page instead of a single frame on the Javadoc web page.

/**
* See <a href="http://google.com" target="_top">Here</a>
* @see <a href="http://www.google.com" target="_top">Here</a>
**/
public class Main {
  /**
  *The entry point of application.
  * @param args the input arguments
public static void main(String[] args) {
     System.out.println("Hello World");
    }
}

Output:

<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">Main</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">See <a href="http://google.com" target="_top">Here</a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://www.google.com" target="_top">Here</a></dd>
</dl>
</li>
</ul>

There is a @link tag that also links Javadoc methods and classes

| @link | @see | | :------------------------------ |!------------------------------------ | | Create an inline link | creates a custom section, isolated link | | Link other or same classes properties, methods, or constructors | Link external URLS |