How to attach source or Javadoc to Java Enterprise Edition API in Eclipse

Eclipse is a great IDE. When you hover your mouse over a class name or method of the Java SE API you get a contextual help for that class or method. However if you do the same thing over a Java EE class, such as HttpServletRequest you might not get the same effect. This is because there’s is no source or Javadoc attached to that class. To attach the documentation to your J2EE class as well you can follow these steps:

  1. Right click on servlet-api.jar in your project.

  2. Choose Properties from the menu.

  3. In Javadoc location path put the URL where the Java EE documentation is located (e.g. https://java.sun.com/j2ee/1.4/docs/api/) or, alternatively, indicate the path where the Javadoc is located in your disk, such as file:/c:/path/to/your/documentation.

Hope this helps!