Hover Help

You've seen that code assist is a good way to explore an unfamiliar API. Another useful tool is hover help. To use hover help, simply move the mouse cursor over a symbol you want to know more about and pause for a moment. For example, try hovering over println in System.out.println. A little pop-up window will appear, giving you a short description of the method.

For best results, you need access to the source code of the symbol you are examining. For Java library methods, the source comes with the JDK (J2SE SDK) package. Eclipse can usually figure out how to find this source code on its own, but see Window → Preferences → Java → Installed JREs to configure the JDK's location.

If you are using code from a third-party JAR file, the source is often provided in a separate file or a subdirectory. You can tell Eclipse about this location by right-clicking on the JAR file in the Package Explorer and selecting Properties → Java Source Attachment.

If you don't have the source code, but you have the API documentation (Javadoc) in HTML form, select the symbol you want information on and press Shift+F2 (Navigate → Open External Javadoc). To make this work, you have to configure the Javadoc URL in the properties for the JAR file: right-click on the JAR file and select Properties → Javadoc Location.

Get Eclipse IDE Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.