The basics of creating your own APIs are pretty simple. When you add comments in your code, you can use the tag /**... */
before each class, variable, constructor, and method to create block comments. These comments work within your code in essentially the same way as the regular block comment tag /*...*/
. However, once we run the Javadoc tool, APIs will be created based on these comments.
The first line of the comment should be a quick description that sums up what it is in front of. This first line will turn into the quick description that we discussed earlier. The rest of your paragraph should consist of a more detailed description of the item.
When you run your javadoc.exe program on your Java class file (as discussed in Handout A6.1, Javadocs), it will create a few .html files in the local directory. If you open up index.html with your Web browser, you will find yourself looking at an API created for your class.
After you understand and know how to run the javadoc tool by hand, you may be interested in the following tutorial.
How to create Javadocs using JCreator.
A tutorial by Elton Yang
If you are like me and using the command line on windows is too bothersome,
then i have a solution for you.
1. configure --> options
2. click on tools
3. click on new
4. select Program
5. browse and grab javadoc.exe
6. now you should have javadoc in the white box
7. click on the + to the left of Tools
8. click on javadoc(the left hand side one)
9. in the arguements section, use "-author -version -private $[JavaFiles]"
10. in the initial directory, i used "$[PrjDir]" to generate the javadocs in the project directory.
11. hit apply/ok
12. click on tools-->javadoc
13. watch as it runs
14. (optional) buy Elton a cookie for writing this tutorial
with this, jcreator has a javadocs tool. if for some reason it doesn't work, download the
pro version and install it. Its prettier and more efficient and i haven't needed to register yet.
Cheers,
-Elton Yang.
Last modified: December 12, 2022
Back to Math