Improve company productivity with a Business Account.Sign Up

x
?
Solved

javadoc problems

Posted on 1998-04-19
10
Medium Priority
?
238 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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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 400 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to implement Singleton Design Pattern in Java.

606 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