javadoc hell

Started by
3 comments, last by Greig Hamilton 17 years, 1 month ago
I am having some *major* problems getting my javadoc to compile. I have very limited experience with the command prompt so please take that into consideration. On my PC (Windows XP), javadoc is stored under: C:\Program Files\java\jdk1.5.0_08\bin\javadoc The .java source file I would like javadoc to compile is located at: C:\Blah\Foo\myClass.java The directory that I would like the HTML API documentation to be stored to is: C:\Blah\API\ I have consulted: (1) my teacher, (2) Google, (3) practically all the known world. Nothing seems to be working. According to Java, I should use the syntax: javadoc -d Doc_Path -classpath File_Path at the command prompt. Where Doc_Path is the directory the HTML should be compiled to, and where File_Path is the location of my class path. I have even gone into my advanced system settings, added a new environmental variable called ClassPath and entered .;C:\Blah\Foo\ to instruct java to look for myClass.java in the correct location. I am so lost..... I will clean the gutters of anyone's house who can help me here.
Advertisement
Okay this is what I did just now and got the JavaDocs to compile.

Go to your directory where javadoc is. (This is the one you listed - C:\Program Files\java\jdk1.5.0_08\bin\javadoc)

Now enter the following:
javadoc -d C:\Blah\API\ C:\Blah\Foo\myClass.java

This will create the Javadocs you need. The option -classpath is used only if you have other classes that you have created that you are referencing but are not creating javadoc info for. I guess if you are using some 3rd party. There is some documentation on the Sun website that explains the -classpath option better than I have just here. But for your current problem you don't need to use this option.
Greig,

First of all - thank you for your help here! Unfortunately, I did *exactly* as you instructed, and I got "illegal package errors."

In reality, my directory names have spaces in them: I only used path names such as Blah or Foo for simplicity.

So the actual directories look something like this:
C:\Documents and Settings\Plywood\Desktop

When I type these into the command prompt with the syntax rules you provided:
javadoc -d Doc_Path File_Path

I get "illegal packet" errors, and I have no idea what that means.

So I tried getting smart, and decided that maybe javadoc was parsing the commands, and tokenizing my commands wrong because my file names (such as Documents and Settings) have whitespaces in them. So I replaced any and all whitespaces with modulos (%) as I thought one does in DOS:

javadoc -d C:\Documents%and%Settings\Plywood\Desktop\API%Docs C:\Documents%and%Settings\Plywood\Desktop\MyProject\MyClass.java

When I do this, I get "cannot find file" errors.

Any suggestions?
Maybe you could try putting the file paths in quotes? Like "C:\My Documents\Blah"? I think I had a problem like that once, and that fixed it.
Eric Richards
You need to enclose all directory addresses with quotes. The spaces in directory and file names confuses dos.

So use "C:\Documents and Settings\Plywood\Desktop" and it should work.

This topic is closed to new replies.

Advertisement