Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java documentation [closed]

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
like image 534
pardeep Avatar asked Jun 29 '11 17:06

pardeep


People also ask

Is Javadoc still used?

Fortunately, all modern versions of the JDK provide the Javadoc tool – for generating API documentation from comments present in the source code.

How do I open a Java document?

Select the desired package, class or method name, right-click and select Show Javadoc. This will launch your default web browser and navigate to the Javadoc for the selected item.

Does Java have documentation?

Whether you are working on a new cutting edge app or simply ramping up on new technology, Java documentation has all the information you need to make your project a smashing success.

What is the Java documentation?

What Does Javadoc Mean? Javadoc is a documentation tool for the Java programming language. The document it creates from the Java sources is in HTML format and describes the application programming interface.


1 Answers

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");
    }

}
like image 151
Paŭlo Ebermann Avatar answered Sep 19 '22 13:09

Paŭlo Ebermann