Adding the JDK Javadoc to the NetBeans IDE
Problem: "No javadoc found" displays in the Editor popup window, how do I install documentation?
Solution: Download and install the "Java SE Documentation" files from the Oracle Technology Network.
- Download documentation for your Java platform (either JDK 5.0, JDK 6, or JDK 7)
- http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html - JDK 7
- http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-doc-download-355137.html - JDK 6 (current version)
- http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html - JDK 5.0
- Save the file, you do not need to unzip it.
- In the NetBeans IDE, go to "Tools > Java Platforms".
- Select the platform that you use, and click the Javadoc tab.
- Click "Add ZIP/Folder" and browse to where you saved the file, e.g. jdk-6u23-docs.zip, then click "Add ZIP/Folder".
- Close the Java Platform Manager.
The JavaDoc popup should now work and display more information on the usage of a command.
For JDKs where the Javadoc (src.zip) is on standard place, the NetBeans IDE detects it by default when you add a new platform.
The NetBeans IDE 7.0 supports the URL of the existing online JDK Javadoc.
The JDK Javadoc is preconfigured with URL pointing to a proper online Javadoc (e.g., http://download.oracle.com/javase/7/docs/api/ for JDK 7).
MacOS Platform Specific Info
The Mac OS X JDK installer puts the JDK into the default /Library/Java/JavaVirtualMachines/ folder.
The latest JDK on Mac OS X 10.6 is /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk.
Below is the list of paths to Javadoc files on the Mac OS X operating system:
- /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/docs.jar - Javadoc
- /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/appledocs.jar - Javadoc for Apple specific classes
The NetBeans IDE 7.0 correctly detects the Javadoc files when you add the JDK (/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk) to the Platform Manager.
Adding Javadoc to a Project
Problem: A NetBeans update breaks the "show javadoc" links, how do I point the NetBeans to the jar itself?
Adding Javadoc via the Library Manager
- In the NetBeans IDE, go to "Tools > Libraries".
- In the Library Manager, choose the Javadoc tab.
- Click "Add ZIP/Folder" and browse to where your project Javadoc is located.
- Specify the Javadoc ZIP or folder and click "Add ZIP/Folder".
- Click "OK" to close the Library Manager.
Adding Javadoc via the Project Properties
- In NetBeans IDE, right-click the project and choose Properties from the popup menu.
- In the Category list, select Libraries.
- In the Compile tab, click the "Add ZIP/Folder" button and browse to where your project Javadoc is located.
- Specify the Javadoc ZIP or folder and click "Open".
- Click "OK" to close the Project Properties dialog box.
In case you added a plain Jar/Folder that does not contain a Javadoc, you need to click "Edit" and, in the Edit Jar Reference dialog box, browse for the Javadoc to attach it.
After you specify the location of the Javadoc, click "Open" to close the Select JAR/folder dialog box, click "OK" to close the Edit Jar Reference dialog box, and click "OK" to close the Propect Properties dialog box.
Adding Javadoc for NetBeans Platform Modules
Only relevant for Ant-based Platform development; Maven-based projects use Maven's standard method of Javadoc association.
Official Online Documentation
Under Tools > NetBeans Platforms, select a platform. If it does not already have defaulted official Javadoc - for example http://bits.netbeans.org/6.9/javadoc/ - and you have have a downloaded platform Javadoc ZIP available (containing Javadoc for all API modules), you may add it here.
Installing from Plugin Manager
The module "NetBeans API Documentation" in Plugin Manager installs the latest released Javadoc for the the "default platform". This is available for browsing offline.
If you added an "External Cluster" to an Ant-based suite project, you would be prompted to supply Javadoc for the cluster in that dialog; the "Edit" button in the suite's Libraries tab permits it to be added later.
To associate Javadoc with a third-party library JAR wrapped in a module, simply go to Tools > Libraries and create a library pointing to the same JAR (with whatever library name you like) and edit its Javadoc.
Note that the JAR referred to from the library definition must match the location of the JAR in the library wrapper module's sources, typically under release/modules/ext.
Viewing the Added Javadoc
Below is the list of different ways to view the added Javadoc in the NetBeans IDE.
NetBeans IDE Main Menu
- In the NetBeans IDE main menu, choose "Source > Show Documentation".
- In the NetBeans IDE main menu, choose "Window > Other > Javadoc".
- In the NetBeans IDE main menu, choose "Help > Javadoc Index Search".
Please note that apart from the listed above ways to view the Javadoc there exist several NetBeans IDE features like Navigator, Code Completion, Inspect Members, Inspect Hierarchy which show the Javadoc.
The NetBeans IDE reports a warning when you attempt to add invalid source roots and Javadoc roots (e.g., if there is neither source nor Javadoc inside).