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?
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 Window menu, then select Preferences.
In the search bar, type jre, and then click Installed JREs.
You can also navigate by expanding the Java tree and selecting Installed JREs.
Select the one named java, or another term like jre7.
Its type must be Standard VM.
Then, edit the installation:
Click the Edit button.
In the JRE system libraries section, 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 path field, enter or Browse for your documentation location, specifically the path containing package-list and index.html.
JAR or ZIP documentation
Ensure the Javadoc in archive radio button is marked.
In the Archive path field, enter or Browse for your full documentation path (e.g. /home/docs/jdk-6-doc.zip).
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
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
Off-Line Java API Documentation in Eclipse?
Integrating Javadoc for Java EE 6 API into Eclipse
where is the servlet-api.jar in glassfish installation?
Related
I have an Eclipse RCP Project.
I am using Eclipse source classes, for that I am have a target platform with Eclipse's update site.
The plugins are imported from the target site, but without the Javadoc.
Quesion:
What is the location of the Eclipse's Javadoc for Eclipse RCP classes?
Add the Javadoc for a jar
It is also possible to add Javadoc to a library which you use.
Download the Javadoc of the jar and put it somewhere in your filesystem.
Open the Java Build Path page of a project via Right click on a project → Properties → Java Build Path. On the Libraries tab expand the library's node, select the Javadoc location attribute and press the Edit button.
Enter the location to the file which contains the Javadoc.
sourcepath="D:/eclipse3.3.2/plugins/org.eclipse.rcp.source_3.3.3.r33x_r20080129-8y8eE9UEUWI6qujeED0xT7bc/src/org.eclipse.osgi_3.3.2.R33x_v20080105/src.zip"
just try to adapte this to your case.
There is a checkbox to import the sources, inside of teh target platform's update-site dialog.
I recently installed Hadoop and am able to run simple programs.
However I would like to view documentation for Hadoop classes within Javadoc browser in Eclipse.
Please let me know how to enable that (I am a little novice with Eclipse IDE).
Thanks.
A couple of suggestions:
If you're using maven for your dependency management, you should be able to expand out the list of Maven dependencies in your Eclipse project, right click the hadoop-core-x.x.x.jar and select Maven -> Download Javadocs
Otherwise you'll need to source the Javadocs from the $HADOOP_HOME/docs/api folder and associated with your hadoop-core-x.x.x.jar in Eclipse. In Eclipse, right click your Java project and select Build Path -> Configure Build Path. Now click the Libraries tab and locate the entry for hadoop-core-x.x.x.jar. Expand the entry to show options for Source, Javadoc etc locations and click the Javadoc location entry. Now click the Edit button to the right and enter the location as the path $HADOOP_HOME/docs/api in the Javadoc URL text box (mine is file:/opt/hadoop/hadoop-1.0.2/docs/api/)
Either way now you should be able to hover over Hadoop classes in Eclipse and the Javadoc will popup. You can also show the Javadoc window that will populate for the class you are currently viewing, or just open an internal browser window and point it at the $HADOOP_HOME/docs/api/index.html file
Another easy solution for those who want to stay updated is to edit the Javadocs path like Chris said:
"In Eclipse, right click your Java project and select Build Path -> Configure Build Path. Now click the Libraries tab and locate the entry for hadoop-core-x.x.x.jar. Expand the entry to show options for Source, Javadoc etc locations and click the Javadoc location entry. Now click the Edit button to the right and enter the location as the path"
but instead of linking it directly to the api you have stored on your hard disk, link it to http://hadoop.apache.org/docs/stable/api/
I have switched my web-application to run on another installtion of Liferay. Consequently, I was able to changle classpath libraries in my project to new server location. This includes JRE System Library and Liferay v6.0 CE. I.e, both these libraries can be added for new server location from Java Build Path dialog.
But the library "Liferay Portlet Plugin API" still refers old Liferay installation path and I see no way to change it.
How is it possible?
UPDATE 1
Here: http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+IDE+Getting+Started+Tutorial
On the very most low picture you can see all three libraries listed in Package Explorer. Two of them I was able to change and the question is about third one.
You can manually change file .metadata\.plugins\org.eclipse.jdt.core\variablesAndContainers.dat.
So open your filesystem browswer (My computer) navigate to your liferay IDE workspace location and go to .metadata\.plugins\org.eclipse.jdt.core. Open file variablesAndContainers.dat and find and edit your jars locations.
After that restart Liferay IDE or simply close and open your project.
UPDATE:
1) Take note of jars that are needed
2) Go to configure build path dialogue than go to libraries and select "Liferay Portlet Plugin API" then click Remove
3) Create folder "lib" directly in your project (not WEB-INF/lib)
4) Add jars to lib folder (from 1.)
5) Select jars and add them to build path (right click - Build path - add to build path)
Or you can crete you User libarary with those jars and than add it to build path
Additionally to chosing correct libraries in classpath dialog, one should also change "target runtime" appropriatedly by right click project and going to properties > Targeted Runtimes.
P.S. And plus one should close project and then open it again.
in my case, following instructions in this question about clearing eclipse cache (-clear option) helped, as changing liferay plugins SDK path wouldn't change the libraries' locations when adding this library to project build path...
This question already has answers here:
How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?
(16 answers)
Closed 7 years ago.
I'm using Eclipse 3.6 Helios (for Java Developers) and want to add the javax.servlet package to one of my projects.
What do I need to configure/download?
To expound on darioo's answer with a concrete example. Tomcat 7 installed using homebrew on OS X, using Eclipse:
Right click your project folder, select Properties at the bottom of the context menu.
Select "Java Build Path"
Click Libraries" tab
Click "Add Library..." button on right (about halfway down)
Select "Server Runtime" click "Next"
Select your Tomcat version from the list
Click Finish
What? No Tomcat version is listed even though you have it installed via homebrew??
Switch to the Java EE perspective (top right)
In the "Window" menu select "Show View" -> "Servers"
In the Servers tab (typically at bottom) right click and select "New > Server"
Add the path to the homebrew tomcat installation in the dialog/wizard (something like: /usr/local/Cellar/tomcat/7.0.14/libexec)
Right click on your project -> properties -> build path. Add to your build path jar file(s) that have the javax.servlet implemenation. Ite depends on your servlet container or application server what file(s) you need to include, so search for that information.
When you define a server in server view, then it will create you a server runtime library with server libs (including servlet api), that can be assigned to your project. However, then everybody that uses your project, need to create the same type of runtime in his/her eclipse workspace even for compiling.
If you directly download the servlet api jar, than it could lead to problems, since it will be included into the artifacts of your projects, but will be also present in servlet container.
In Maven it is much nicer, since you can define the servlet api interfaces as a "provided" dependency, that means it is present in the "to be production" environment.
Go to
JBoss\jboss-eap-6.1\modules\system\layers\base\javax\servlet\api\main
include JAR
jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar
For me it worked
For me doesnt put jars to lib directory and set to Build path enought.
The right thing was add it to Deployment Assembly.
Original asnwer
Download the file from http://www.java2s.com/Code/Jar/STUVWXYZ/Downloadjavaxservletjar.htm
Make a folder ("lib") inside the project folder and move that jar file to there.
In Eclipse, right click on project > BuildPath > Configure BuildPath > Libraries > Add External Jar
Thats all
Is there a way to tell Eclipse to not include specified files, directories, or patterns in a JAR or WAR?
You can specify includes and excludes by opening the Project Properties (alt-enter) then opening Java Build Path and the Source tab. Against each source location there is a little plus sign, click on that then select Included or Excluded then select the Edit... button.
source path screenshot http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.user/gettingStarted/images/qs-WorkingWithExistingLayout26.png
You can then specify multiple patterns for files to be included/excluded. These files will not be processed to the output directory. The patterns follow Ant's wildcard patterns so you have quite fine-grained control over what to include.
(source: eclipse.org)
We fought with this problem too and didn't find a good standard solution for it in Eclipse WTP.
Hence we added Project Archives to JBoss Tools (http://jboss.org/tools) which allow you to control explicitly via "ant filter sets" what goes in and what goes out of your archive.
This archive you can then deploy with the standard WTP mechanism for deployment on the server types supplied by JBoss tools.
We are working on adding similar support back into native Eclipse WTP, but that won't be available until sometime next year.
to add to what #Rich_Seller said: in Eclipse Indigo:
Select your package from the package view right click, and choose Export.
Choose Java -> JAR file from the "select an export destination" tree.
Click Next to go to the next page of the wizard.
Under the "Select the resource to export" you are presented with a
tree view here you can select and deselect components that will be
included and excluded from the JAR.
I think including an XML file in another and then removing its visibility in the war file should give you an on off switch.