Creating JavaDocs in Eclipse
22 November 2007Java 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 undertand 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.<br>
* JavaDoc Comments are useful.<br>
*/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.
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.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Creating JavaDocs in Eclipse