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?
1 Answers
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:
- Online (e.g. http://docs.oracle.com/javaee/6/api/)
- To a local JAR or ZIP file
- To a local folder containing the extracted docs
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:
- Tomcat:
lib/servlet-api.jar - Glassfish:
modules/javax.servlet-api.jar
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:
- In Eclipse, open the
Windowmenu, then selectPreferences. - In the search bar, type
jre, and then clickInstalled JREs.- You can also navigate by expanding the
Javatree and selectingInstalled JREs.
- You can also navigate by expanding the
- Select the one named
java, or another term likejre7.- Its type must be
Standard VM.
- Its type must be
Then, edit the installation:
- Click the Edit button.
- In the
JRE system librariessection, click the Add External JARs... button. - 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
- Ensure the Javadoc URL radio button is marked (it is by default).
- In the
Javadoc location pathfield, enter or Browse for your documentation location, specifically the path containingpackage-listandindex.html.
JAR or ZIP documentation
- Ensure the Javadoc in archive radio button is marked.
- In the
Archive pathfield, enter or Browse for your full documentation path (e.g./home/docs/jdk-6-doc.zip). - In the
Path within archivefield, enter or Browse for the path containingpackage-listandindex.html(e.g.docs/api).
Finishing the Attachment
- Click the Validate button to ensure everything is set correctly.
- Click the OK button, then the Finish button, and finally the OK button.
- Your documentation is now linked to the servlet you specified and ready for use in Eclipse. =)
References
- 1
- 1
- 1,918
- 3
- 21
- 32