开发者

java documentation [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 5 years ago.

开发者_C百科 Improve this question

i am not able to create documentation for this code,i think my coomad of javadoc is not right, i read about it but don't understand ,can anybody correct by javadoc cammand

class abc
{/** documentaion line 1
*
* */
public static void main(String a[])
{/** documentaion line 2
*
* */
System.out.println("documentation");
}
}
Error:
C:\Program Files\Java\jdk1.6.0\bin>javac abc.java

C:\Program Files\Java\jdk1.6.0\bin>java abc
documentation

C:\Program Files\Java\jdk1.6.0\bin>javadoc abc
Loading source files for package abc...
javadoc: warning - No source files for package abc
Constructing Javadoc information...
javadoc: warning - No source files for package abc
javadoc: error - No public or protected classes found to document.
1 error
2 warnings


In your case, you would want to provide the file name instead of a package name.

javadoc abc.java

Then the no source files error message will disappear. The no public classes error message will still be there - add public before your class declaration. Alternatively, you can pass the -package or -private flag to Javadoc to include non-public classes too.

Then move the documentation comments directly before the declarations you want to comment:

/**
 * class documentation here
 */
public class abc
{

    /** 
     * method documentation here 
     */
    public static void main(String a[])
    {
      /**
       * this will be ignored.
       */
       System.out.println("documentation");
    }

}


As the error message clearly says, Javadoc creates documentation for public or protected classes and methods (members that are visible from outside your package).

You don't have any.

Also, Javadoc takes a package (folder or JAR file), not a classname.


This is old, I know, but I found a solution that worked for me. It isn't package based but it took me forever to figure it out so I figured I'd share it:

javadoc -private *.java

The private option is the key here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜