The solution on this page is a hack. It is not a port of Docco for Java the way Jocco or Marginalia is. There, you’ve been warned.
Get nodejs and the node package manager.
Docco depends those two. We can install these tools either by using Homebrew or by downloading the installation package of nodejs from http://nodejs.org
brew install -g node brew install -g npm
Then, get Docco using the node package manager sudo npm -g install docco
Next, install pygments
sudo easy_install pygments
Next, edit the docco script
The script file of docco can be usually found at
Edit the script and add the .java entry to the languages object literal.
The code snippet above can be found somewhere between line 90 to line 120 of docco.js. The java entry was added so docco can generate nice docs for Java source files.
Remember to write your comments using the C++ style (//). Docco will not parse the comments using JavaDoc style or C style comment block.
Using docco is very simple, run it against any supported file, for example
Now, you can test it.
Get the Newsletter
We can send tutorials straight to your inbox.SUBSCRIBE