How to add eclipse-source javadoc to java-build-path in? - eclipse

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.

Related

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?
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?

Hadoop Documentation for Eclipse

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/

Eclipse - How to give dependency between projects?

I have two java projects in eclipse. Second one is using first one's jar. When I try to navigate to first one's class from second one, it opens .class of that file. But I want to open the first one project file. Please help.
Thanks in advance.
If you want to link your second project with your first project, don't add the first project in form of a JAR file to the second.
Instead open the project properties of the second project and select "Java Build Path". On the right side on the "Projects" tab you can add your first project as "required project on the build path".
The class files of project 1 are now added to the class path of project 2. And if you click on a class name you directly get to the source code.
Ideally, the JAR of the first project would appear under the "Referenced Libraries" of the second project.
Right-click on that JAR, and choose Properties -> Java Source Attachment.
Provide a variable that links to the source files of this JAR.
Alternatively, install a decompiler plugin (see jd-eclipse) which will decompile class files when you navigate them in Eclipse, so that you can see the source.
Make one project in Eclipse depend on another so that the dependencies are available in the indexer
Tested on Eclipse IDE for C/C++ Developers 2022-09 (4.25.0) on Linux Ubuntu 18.04.
For C++, right-click on the project which depends on another project. Go to "Properties" --> Project References --> check the box next to the project whose files and resources you'd like to be available in the project you are editing --> click "Apply and Close".
The indexed resources in the project next to the box you just checked (glib in the screenshot below) are now available to the project whose properties you just edited! This means if you Ctrl + Click a variable which is defined in the project you are editing, your indexer will now jump to its definition even if it lies in the referenced project (glib in this case)!
Screenshot:
Done!
Old and wrong answer (but may be helpful for adding includes to your project)
For C++, right-click on the project which depends on another project. Go to "Properties" --> C/C++ Include Paths and Symbols --> click "Add Include Path from Workspace..." --> choose the project from your workspace which it depends on, and drill down into the folder of interest --> click "OK". Click "Apply and Close".
You've now made your project whose properties you just edited depend on the other project in such a way that the dependent project dir you just added will now be indexed!

How to change Liferay Portlet Plugin API library in Eclipse?

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...

HttpClient javadoc jar (for netbeans 7)

I am looking to add the javadoc (jar) for HttpClient to my IDE (Netbeans). Has anyone actually seen the jar file? or is there another way to add javadocs to Netbeans (or Eclipse).
To do this, the best way is to add a new library in the IDE and attach the Javadoc to this library. You can try the following steps to do this:
In the NetBeans IDE, go to "Tools > Libraries".
In the Library Manager, click at New Library and enter the data requested if the library don't exists
Select the library you want to add the Javadoc, and choose the Javadoc tab.
Click "Add ZIP/Folder" and browse to where your project Javadoc is located.
Specify the Javadoc ZIP or folder and click "Add ZIP/Folder".
Click "OK" to close the Library Manager.
More details can be found at this NetBeans Wiki page.
Regards