john john - 2 months ago 11
Java Question

javadoc: how to use it to document ONE single java file on Window 7?

I'm trying to use javadoc to document one single java file on window 7,to simplify things, I only use the following simple command:


However, javadoc gives me IllegalArgumentException without detailed where it is wrong, actually, the file I used is copied from The Java Programming. So, I'm wondering what is required to use "javadoc" comand in the window environement.

It seems to be working at first ...

Loading source file
Constructing Javadoc information...
Standard Doclet version 1.6.0_20
Building tree for all the packages and classes...
Generating Attr.html...

But then it starts throwing errors like this:

at sun.misc.URLClassPath$FileLoader.<init>(
at sun.misc.URLClassPath$
at Method)
at sun.misc.URLClassPath.getLoader(
at sun.misc.URLClassPath.getLoader(
at sun.misc.URLClassPath.findResource(
at Method)
at java.lang.ClassLoader.getResource(
at java.lang.ClassLoader.getResourceAsStream(
at javax.xml.parsers.SecuritySupport$
at Method)
at javax.xml.parsers.SecuritySupport.getResourceAsStream(
at javax.xml.parsers.FactoryFinder.findJarServiceProvider(
at javax.xml.parsers.FactoryFinder.find(
at javax.xml.parsers.SAXParserFactory.newInstance(

Here is the java test file I used:

* An <code>Attr</code> object defines an attribute as a
* name/value pair, where the name is a <code>String</code>
* and the value an arbitrary <code>Object</code>.
* @version 1.1
* @author Plato
* @since 1.0
public class Attr {
/** The attribute name. */
private final String name;
/** The attribute value. */
private Object value = null;

* Creates a new attribute with the given name and an
* initial value of <code>null</code>.
* @see Attr#Attr(String,Object)
public Attr(String name) { = name;

* Creates a new attribute with the given name and
* initial value.
* @see Attr#Attr(String)
public Attr(String name, Object value) { = name;
this.value = value;

/** Returns this attribute's name. */
public String getName() {
return name;

/** Returns this attribute's value. */
public Object getValue() {
return value;

* Sets the value of this attribute. Changes the
* value returned by calls to {@link #getValue}.
* @param newValue The new value for the attribute.
* @return The original value.
* @see #getValue()
public Object setValue(Object newValue) {
Object oldVal = value;
value = newValue;
return oldVal;

* Returns a string of the form <code>name=value</code>.
public String toString() {
return name + "='" + value + "'";

SOLUTIONS - Thanks to Michael Borgwardt

first issue:





Hm... considering that the error happens in a ParseUtil called by the URLClassLoader: is it possible that you have a CLASSPATH environment variable set whose content is malformed? Try this:

javadoc -classpath .