Howardism Musings from my Awakening Dementia
My collected thoughts flamed by hubris
Home PageSend Comment

Eclipse Code Documentation

Often I'll be looking at a piece of code like the following:

doc.appendChild( doc.importNode( root, true ) );

And I'll think, "What da hell does 'true' mean?" In this particular case, I wrote it, but still, I expect my IDE to quickly explain all about the "importNode" method (for instance). Eclipse does this if you click on the method, and then hit the 'F2' key.

However, it typically only knows about methods that are part of the standard Java distribution, and wouldn't know anything about special libraries you might be calling.

So, do the following steps:

  1. Right-click on your project, and select 'Properties'. Click on the 'Java Build Path' item, and then on the 'Libraries' tab. For each library that you've added, click on the '+' symbol, and you'll see 'Javadoc location' … highlight that and click the 'Edit' button to specify where you've stored the Javadocs for that library.

  2. Rinse and repeat.

  3. If you have downloaded for speed or whatever, a copy of the standard Javadocs, go into Preferences -> Java -> Installed JREs, and double-click on your VMs listed there. The field 'Javadoc URL' can be changed to the location on your file system that contains your downloaded copy of the standard Java documentation.

Now, 'F2' is a brief summary and may not be too helpful, but if you hit 'Shift-F2', it will pull up the right Javadoc file in your browser full of hyperlinks and more good stuff.

Another idea is to add the 'Javadoc' editor (via 'Window -> Show View -> Javadoc') and whatever you click on, will have its Javadoc show up in a window at the bottom of your screen.

Tell others about this article:
Click here to submit this page to Stumble It