This discussion is archived
2 Replies Latest reply: Jul 19, 2010 6:52 PM by 843810 RSS

Javadoc Tool Processes More Files Than I Want

843810 Newbie
Currently Being Moderated
Hi,

I'm running the command line javadoc tool. In the current directory, I have two files, HelloWorldApplet.java (which is syntactically correct), and a Broken.java (which has a syntax error in it).

I'm invoking Javadoc using the command line
javadoc -d doc HelloWorldApplet.java
and it also processes the Broken.java file, generating syntax errors.
% javadoc -d doc HelloWorldApplet.java
Loading source file HelloWorldApplet.java...
Constructing Javadoc information...
Standard Doclet version 1.5.0_19
Building tree for all the packages and classes...
Generating doc/HelloWorldApplet.html...
Generating doc/package-frame.html...
Generating doc/package-summary.html...
Generating doc/package-tree.html...
Generating doc/constant-values.html...
Generating doc/serialized-form.html...
./Broken.java:1: <identifier> expected
class class Bad2835156
      ^
./Broken.java:1: '{' expected
class class Bad2835156
                      ^
Building index for all the packages and classes...
Generating doc/overview-tree.html...
Generating doc/index-all.html...
Generating doc/deprecated-list.html...
Building index for all classes...
Generating doc/allclasses-frame.html...
Generating doc/allclasses-noframe.html...
Generating doc/index.html...
Generating doc/help-doc.html...
Generating doc/stylesheet.css...
2 errors
How do I tell Javadoc to just process the file I am specifying?

I'm using a Mac with OS X 10.4, Java 5, and the files I am using can be found [in this zip file|http://www.cs.rice.edu/~mgricken/tmp/javadocProblem.zip] .

Thanks for your help.

--Mathias                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
  • 1. Re: Javadoc Tool Processes More Files Than I Want
    EJP Guru
    Currently Being Moderated
    If HelloWorldApplet refers to the class with the syntax error, Javadoc has to 'compile' it up to a point so it can procedss HelloWorldApplet.

    I suggest you fix the syntax error.
  • 2. Re: Javadoc Tool Processes More Files Than I Want
    843810 Newbie
    Currently Being Moderated
    Thank you for your attempt to help me, ejp.

    The file HelloWorldApplet.java does not refer to the other file at all. I don't see a reason for it to consider the file Broken.java.

    Just "fixing" the syntax error isn't so easy. I'm a developer of an IDE that uses Javadoc as a tool, and I don't just want to tell my user to "just fix the syntax error".

    Here is another simplified example:

    File A.java:
    import javax.swing.JApplet;
    
    public class A extends JApplet {
    
    }
    File Broken.java:
    class class Broken
    When I try to Javadoc just A.java using the command line
    javadoc -d doc A.java
    I get this output with an error:
    $ javadoc -d doc A.java
    Loading source file A.java...
    Constructing Javadoc information...
    Standard Doclet version 1.6.0_21
    Building tree for all the packages and classes...
    Generating doc\A.html...
    Generating doc\package-frame.html...
    Generating doc\package-summary.html...
    Generating doc\package-tree.html...
    Generating doc\constant-values.html...
    Generating doc\serialized-form.html...
    .\Broken.java:1: <identifier> expected
    class class Broken
         ^
    .\Broken.java:1: reached end of file while parsing
    class class Broken
                    ^
    Building index for all the packages and classes...
    Generating doc\overview-tree.html...
    Generating doc\index-all.html...
    Generating doc\deprecated-list.html...
    Building index for all classes...
    Generating doc\allclasses-frame.html...
    Generating doc\allclasses-noframe.html...
    Generating doc\index.html...
    Generating doc\help-doc.html...
    Generating doc\stylesheet.css...
    2 errors
    If I don't have an "extends" clause for the class A, then Javadoc doesn't try to process the Broken.java file.

    Can somebody please tell me why Javadoc is looking at Broken.java, and how I can prevent it from doing that?

    Thank you.

    --Mathias

    Edited by: mgricken on Jul 19, 2010 8:52 PM