How to get code completion with Javadocs in Netbeans on Mac OS X

I'm sure I'm the last Mac Java developer here to figure this out so I'm posting it not so much for you but for future generations intrepid googlers to find.

How to get Netbeans code completion with Javadocs to work in Mac OS X

Netbeans is a great IDE and I'm really starting to warm up to it (starting to warm up to IDEs in general, actually). One of my big complaints so far has been the lack of Javadocs in the code completion popup window. Since I had some extra time today I thought I'd finally figure it out.

The reason Netbeans doesn't have javadoc code completion on the Mac, but does on other operating systems, is that Apple doesn't ship the src.jar by default. This is the jar which contains the source code to Java (at least the public APIs, go to the jdk project for the rest), and more importantly: all of the Javadocs. No src.jar, no javadocs. So the simple remedy is to install them. Here's how you do it:

  1. Download the J2SE 5.0 Documentation bundle from Sun at http://java.sun.com/j2se/1.5.0/download.jsp
  2. Unzip the downloaded file and place it wherever you want to store your documentation.
  3. Open netbeans and go to the Tools -> Java Platform Manager menu.
  4. Select the default platform (you may have only one), select the Javadocs tab, then press the Add Zip/Folder button.
  5. In the file chooser navigate to the docs directory and select the api directory.
  6. Pat yourself on the back. You now have code completion with javadocs.

Sweet!

Talk to me about it on Twitter

Posted April 30th, 2006

Tagged: java.net