Solved

javadoc problems

Posted on 1998-04-19
10
231 Views
Last Modified: 2010-04-16
When I run javadoc on my source files I get 3 files which are basically empty (except for the standard titles that javadoc generates) - AllNames.html, packages.html and tree.html. I don't get any of my classes documented
My source file <MyClass.java>  follows:

package TestDoc;

/**
* Test the javadoc utility
*
* @version %I%, %G%
*/
class MyClass
{
      /**
      * This is some class to test
      * @param y      The Parameter
      */
      public void MyMethod(int y)
      {
            int x = y;
      }
}

This file resides in directory TestDoc and I am running the following line from that directory:
javadoc *.java

Thanks
0
Comment
Question by:RHonig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 1

Expert Comment

by:froderik
ID: 1219098
Sounds strange, does javadoc give you any valuable error message?
0
 
LVL 6

Expert Comment

by:jpk041897
ID: 1219099
Try it as follows:



    package TestDoc;

    /**
    * Test the javadoc utility
    *
    * @version %I%, %G%
    * <;pre>;
    *    MyClass  cls  = new MyClass();
    *    void myMethod(int show);
    * <;/pre>;


    */
    class MyClass
    {
    /**
    * This is some class to test
    * @param y The Parameter
    *
    * y represents the value to assign to x.
    * @see MyClass#1
    */
    public void MyMethod(int y)
    {
    int x = y;
    }
    }


And since you are using a package, you will also need to use the CLASSPATH option in your call to javadoc.

CLASSPATH  

Used to provide the system a path to user-defined classes. Directories are separated by semi-colons, for example,  


.;C:\users\dac\classes;C:\tools\java\classes

0
 

Author Comment

by:RHonig
ID: 1219100
I cut n pasted your (jpk's) suggestion (I got rid of the package statement to remove that factor for now) and ran javadoc again but got the same results.
The output I get when running javadoc is:
C:\Java\TestDoc>javadoc *.java
Generating package.html
Generating index
Generating tree

but none of these output files contain any reference to my classes.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:froderik
ID: 1219101
I just tried it out. For me it works just fine to run javadoc on packaged files with or without CLASSPATH. The documentation for different classes are correctly generated. I am using JDK 1.1.5 on Windows NT 4.0. Perhaps the earlier versions of JDK had a less useful behavior? Which version do you use? If you are using an old version an update may help. (If you are lucky...) If you don't wanna update you should follow jpk's suggestion and take a closer look at your CLASSPATH variable.

Hope this help.
0
 

Author Comment

by:RHonig
ID: 1219102
I am using JDK 1.1.5, NT 4.0 too.I'll try playing around with the CLASSPATH a bit. Another possible factor is, I installed Visual Cafe 2.5 after installing JDK115, but I'm only using Cafe for editing, it may however, have messed something up.
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1219103
This receipt should work. In a ".bat" file, let say "doc.bat", write the following:

SET CLASSPATH=.;c:\jdk1.1.5\lib\classes.zip
javadoc TestDoc

Put it in a directory. A sub-directory of it should be called "TestDoc" (the name of the package)
and should contain the source of the classes of that package. Running doc.bat should generate the doc.


0
 
LVL 5

Expert Comment

by:fontaine
ID: 1219104
Hello RHonig! Did my answer solve your problem, finally?
0
 

Author Comment

by:RHonig
ID: 1219105
Sorry fontaine, that wasn't it.
I found out that my problem was that the class was not declared as public.
As soon as I declared the class public I got all the methods and members I was expecting
0
 
LVL 4

Accepted Solution

by:
evijay earned 100 total points
ID: 1219106
Create the file MyClass.java in a directory TestDoc
Set the classpath to the directory parent of TestDoc
Give the javadoc with the following options in the parent directory of TestDoc

javadoc -private TestDoc\*.java

for more options on javadoc type  "javadoc - help" on command line

0
 

Author Comment

by:RHonig
ID: 1219107
That was it. I should read the documentation more carefully. I guess this is a case of "RTFM...Read the F... Manual", but at least you got 100 points for your trouble.Thanks for the pointer.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question