eclipsejakarta-eecontent-assist

How do I integrate the Java EE docs / API into Eclipse?


I want to set up my Eclipse installation so that when I use the content assist and hover over / inspect a method therein, it shows me the Java EE documentation. How do I integrate it?


Solution

  • You'll need to locate your documentation and your server's servlet JAR, and then add the JAR to your installed JRE and attach the documentation. This answer presumes you have already installed your server and integrated it into Eclipse.

    Documentation

    You can link to documentation in a few ways:

    Whichever way you decide, be sure you have the location handy.

    Servlet JAR

    You'll need to find the servlet JAR for your server setup. The JAR and its location depend on which server you use. Navigate to your server's installation directory and find the file as follows:

    This list is by no means exhaustive. Regardless, be sure you have the JAR's location handy also.

    Add the Servlet JAR to the JRE Installation in Eclipse

    Navigate to your JRE installation as follows:

    1. In Eclipse, open the Window menu, then select Preferences.
    2. In the search bar, type jre, and then click Installed JREs.
      • You can also navigate by expanding the Java tree and selecting Installed JREs.
    3. Select the one named java, or another term like jre7.
      • Its type must be Standard VM.

    Then, edit the installation:

    1. Click the Edit button.
    2. In the JRE system libraries section, click the Add External JARs... button.
    3. Navigate to your servlet JAR and click the Open button. It appears at the bottom of the list.

    Attach the Documentation

    First, select your newly-added servlet JAR and click the Javadoc Location... button. The way you attach the documentation depends on its source.

    Online or extracted documentation

    1. Ensure the Javadoc URL radio button is marked (it is by default).
    2. In the Javadoc location path field, enter or Browse for your documentation location, specifically the path containing package-list and index.html.

    JAR or ZIP documentation

    1. Ensure the Javadoc in archive radio button is marked.
    2. In the Archive path field, enter or Browse for your full documentation path (e.g. /home/docs/jdk-6-doc.zip).
    3. In the Path within archive field, enter or Browse for the path containing package-list and index.html (e.g. docs/api).

    Finishing the Attachment

    1. Click the Validate button to ensure everything is set correctly.
    2. Click the OK button, then the Finish button, and finally the OK button.
    3. Your documentation is now linked to the servlet you specified and ready for use in Eclipse. =)

    References