Solved

javadoc problems

Posted on 1998-04-19
10
227 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now