Solved

javadoc problems

Posted on 1998-04-19
10
224 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
nestparen challenge 4 57
JAVA part two 5 42
java 8 lambda expresssions exception handling 3 41
Java Timer (static) 9 19
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

743 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

10 Experts available now in Live!

Get 1:1 Help Now