Link to home
Start Free TrialLog in
Avatar of roy020697
roy020697

asked on

javadoc integration with jdk docs

This sounds simple, but I can't seem to do it. What I would like to do is have javadoc integrate my generated documentation with the jdk files. In other words, when javadoc generates tree.html, for instance, how can it generate links under "Class Hierarchy" to java.lang.Object and all other classes within the language? Is there a way to  append and proliferate these links when my classes extend the stuff in jdk? I tried copying the jdk doc html files to the same directory as my javadoc output, but javadoc did not like this. javadoc preferred to overwrite exising files.

Has anyone found a way to do this or something similar? I need an automated solution; hopefully something for a makefile.

FWIW, I'm using jdk1.1.1 under Solaris.
Avatar of jpk041897
jpk041897

Here is an example:

/**
 * A class representing a window on the screen.
 * For example:
 * <;pre>;
 *    Window win = new Window(parent);
 *    win.show();
 * <;/pre>;
 *
 * @see            awt.BaseWindow
 * @see            awt.Button
 * @version        1.2 12 Dec 1994
 * @author         Sami Shaio
 */
class Window extends BaseWindow {
        ...
}
 
For this to actualy work though, you need to make sure that the java source files are in the class path used by javadoc. You must therfore override the default classpath with:

javadoc -classpath .;/usr/jdk1.1/src

I'm not sure this answer actually addresses your question so I'm posting as a comment.
Avatar of roy020697

ASKER

Correct; it does not address my question :-)
Thanks for the comment, though.

Here is what I am looking for:
PLease look (in your environment) at the file $JDK_DIR/docs/api/packages.html with a browser. Scroll to the bottom where it says "Other Packages". In JDK1.1.1 this lists stuff from Sun (package sun.tools.debug, sun.io, sun.util). I would like my packages there, too!

Now, select the link to package sun.utils. Now select the class EventObject. Notice how the heirarchy java.lang.object and java.util.EventObject are hyperlinks? That is also what I want!

I have my classpath initialized properly so that I can compile. I have all my classes included in a named package "com.sterlingdi". Assuming my current working dir is /cwd my java source files are in the directory /cwd/com/sterlingdi. I have a docs directory /cwd/docs. I even copied all the $JDK_DIR/docs/api/* files to /cwd/docs and made them writable so javadoc could replace certain files like packages.html, tree.html, etc.
I must be doing something wrong... doen't anyone else have their javadoc output integrated with the java language API docs?
Looks like the price is too small. Tell ya what I'll do; I'll raise the stakes a bit, but to collect I need a workable solution. The answer "you can't do that!" might be true, but it will not get you the points. If the answer I seek can't be done with the tools supplied by Sun, then there must be a sed/awk hacker out there who could rise to the challenge!
Adjusted points to 300
I'm not sure if this will work, so it's a comment.

Have you tried putting your src files into the jdk1.1.1/src/ directory and then javadoc-ing them all.  ie completely regenerate all the java.* files at the same time.

As far as I can see this should work.
Well,

I have two suggestions and one comment.

1.- One way (unsatidfactory) that you can achieve your goal is to use embeded HTML code inside your documentation sections of code (like the Sun source uses). I won't go deeper into this since its really a waste of time based on the next suggestion.

2.- Take a look at:

http://www.oasis.leo.org/java/development/documenting/00-index.html

and download Doc++

For a simple sample page generated by Doc++ see:

http://www.oasis.leo.org/cgi-bin/leo-peek/java/_/development/documenting/docxxdoc.zip/_/HIER.html


If this does solve your problem, then please bring down the points (to my knoledge none of the experts here is actualy making anu money) and this answer is certanly not worth 300 points! If this solves your problems, use up some of those points for another question.
jpk-

I'm not sure what you were driving at with embedded HTML in my doc sections of code... the parts of my html that I want hyperlinks to are not extraced (directly) from my code; it is in the headers generated by javadoc (see original post & my first comment). Doc++ looks like a good javadoc rip-off which generates consistant looking documentation for java and C++, but it still won't put the hyperlinks where I'd like.

BTW, it is a lot of points for a simple question, but I needed the answer quickly, and I have points to burn :-)

rkin005-
It was too easy! I did not notice the src.zip file that came with the Solaris install in $JDK_HOME. I unzipped this file in the top of my package hierarchy, moved a couple of directories around, ran javadoc, and it ran out of memory on a Sun Ultra with 128MB of RAM! I added -J-mx64m -J-ms64m to the javadoc command line and five minutes later thousands of html files were produced. The links were right where I needed them! Maybe you should only get credit for alerting me to the fact that there is a bunch of java source files bundled in with the JDK, but I would have spun my wheels for days (weeks?) without that clue.

On the other hand, jpk did have his original answer which included CLASSPATH pointing to a directory which could contain java API source code. My installation had no such directory... just a src.zip file in the jdk1.1.1 dir.

You should both split the prize, but since the points are only worth bragging rights I'll award them to the first one of you two who posts an answer. It may not be fair, but it is not worth the effort to reduce these points, post a fake question, wait for the  right person to answer, etc...
I have brag points to spare :-)

rkin005 was closer to the mark so they are his, Or perhaps, if rkin005 agrees, since neither of us actualy answered your question, we should just let it stand  and let you recover your points.
I had the same problem before and I fortunately solved it.
It was the previous year and I don't remember it very well
but I have a starting point for you...
Something sure is that the processus should be made in
two steps. In one step you specify the name of your package
as an argument to the javadoc command and in the second step
you give the name of the source files as arguments.
It should be something like:
javadoc -sourcepath source_path -d destination_path package_name
javadoc -sourcepath source_path -d destination_path *.java
I don't remember which one should be made before which.
I beleive that javadoc ... *.java is the command that should be
made first (but I'm not sure).
Ah, another thing... one of the problem might be that the second command (whatever it is) will erase some of the html files
you want to keep (index.html and/or tree.html and/or packages.html)
The solution is either to move those files to another directory
and then moving them back when you have finished or you can use the -noindex or -notree options when using javadoc.

With this informations you should be able to find out the exact
way to do it and make a shell-script that automate that.

Hope this helps!

If you had read any of the threads in this question (or at least my last comment) you would realize that this question has already been answered and I am waiting for rkin005 to claim his points.

Your answer is vague and incorrect. It can be accomplished in one step. Thanks for trying, but please read the question *and* the responses before posting; it prevents you from sounding uninformed.
OK, how do I claim my points - all of them !!

no just kidding.  I agree it was a bit easy once you knew how.  How about we each get 50, and roy keeps the rest.
Alternatively I'll take them all if this is too much bother ;)

If you could (fully) answer my question in the Java area - ie get an RMI example to work in Netscape Communicator that would be equivalent.

anyway, whatever I'm not that bothered either.

regards,

Rory
rkin005@abs-student.auckland.ac.nz
 
Rory-

I am not able to decrease the points awarded; I can only increase them :-/  Good news for you; jpk doesn't want them -- (s)he feels that your answer was closer to the mark.

To collect your points, instead of posting a comment by clicking the Comment radial button, click on the Anser radial button.  Then add some text to the text area (your answer) and press the Submit button. This locks the question until I grade your answer. When I give you a passing grade you will get an e-mail notification and the points are added to  your account.

As for your RMI question, I'll check it out and post something constructive if I can help.

Thanks again for your time.

-Roy

Rory-

I could not find your question on RMI (or any question from you) posted in the Java area... when was it posted?
ASKER CERTIFIED SOLUTION
Avatar of rkin005
rkin005

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the answer, Rory.

Yes, I sawyour question after I posted my comment (sorry about that!).
I've been trying to get the RMI demo to work for me, too. I'va had marginal success after several other interruptions this afternoon. I'll have another go at it tomorrow.