View RSS Feed

My Java Tips

Creating JavaDocs in Eclipse

Rate this Entry
by , 11-09-2011 at 06:42 PM (4385 Views)
Java Docs are of great importance for Java programmers. Every Java programmer uses it to know which functions are to be used to achieve the results.
Java Docs provide useful information including:
- Which classes exist in a package
- Purpose of each class
- Constructors in a class
- Methods in a class
- Method parameters and return types
- Deprecated methods
- Exceptions that a method raises
- Version and Author of the class
- Etc.

Now can we generate Java Docs for our packages/classes. The answer is yes. Java provides javadoc.exe for this purpose. I will show you how to use it in Eclipse to generate JavaDocs.

I assume that you know the basis of Eclipse and can create packages and classes. Lets move ahead. You have to annotate your code with comments to make javadoc.exe understand your packages/classes/constructors/methods.

JavaDoc comments are easy. They start with a forward slash and two asterisks (/**) and ends with one asterisk and a forward slash (*/).Everything between the delimiters (even if it spans multiple lines) is a comment.

* @author Laiq
* This is a test class.
* JavaDoc Comments are useful.

To generate Java Docs for your project, you have to the following:
Click Project from the Eclipse menu bar and select JavaDoc.


Browse to the javadoc.exe file, then select all the projects for which you want to generate the docs and finally select the basic options and proceed.

Generation Options

Now you will have the generated documents.

javadoc.exe will convert source file's JavaDoc comments into an HTML JavaDoc file which is very useful for the developers especially if they are working in a team.

Submit "Creating JavaDocs in Eclipse" to Facebook Submit "Creating JavaDocs in Eclipse" to Digg Submit "Creating JavaDocs in Eclipse" to Submit "Creating JavaDocs in Eclipse" to StumbleUpon Submit "Creating JavaDocs in Eclipse" to Google

Tags: None Add / Edit Tags