Hadoop Documentation for Eclipse - 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/

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?

Eclipse does not remember external source attachments

Using Eclipse 4.3.1 (Kepler) on Ubuntu, I find that each time I exit and reenter Eclipse, I have to respecify my external source attachments. What is the key to making Eclipse remember them?
Open the Source Attachment Configuration dialog by clicking on the "Change Attached Source" button in the Class File Editor; or open the similar Java Source Attachment dialog by right-clicking on the containing jar in Package Explorer and selecting "Properties".
I've tried both.
In the dialog, click on the "External File" button and navigate to a jar containing sources, or click on the "External Folder" button and navigate to a directory containing .java files in subdirectories corresponding to the package hierarchy.
All these ways work until I quit Eclipse and come back in.
I have never used these parts of Eclipse; I'm using Maven to manage my dependencies and Maven will automatically attach sources - so take my answer with a grain of salt :-)
I'm not sure why Eclipse doesn't remember those settings. My current feeling is that those settings are temporary.
If you edit the source attachments in the project's properties (look for "Java Build Path"; there is a tab "Libraries"), then the changes should be saved in the file .classpath. Have a look in there.
Lastly, you can try to create a "User Library" (search for this term in the preferences dialog). Here, you can define a bundle of JARs which make up some library. After adding the code JAR, you get options to specify the source JAR.

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

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.

.class file opens instead of .java while debugging

Current setup:
MainProject which is a Library Project
BranchProject which is a new projects and has MainProject as a Reference
Whenever I debug and a file from MainProject is on focus (actually BranchProject has only graphic and xml layout changes) the Debug window opens a .class file which is read only. I want it to open the .java file so I can edit it directly.
Skyler's answer from this post worked for me:
Opening source code from debug view edits .class after Android R18 update
Here is a summary:
The fix is to right click the Project name in the debug view, and select "Edit Source Lookup..." from the menu. From there, remove the Default lookup path. After that, manually add the associated projects (not jars) that your project references. This is done by clicking Add, selecting Java Project, then checking the appropriate projects.
When you're using a Library project one of the things you're in fact doing is compiling your Library project into a jar and then referencing that jar in your calling Project.
If you right click the Project, and select "Configure Build Path" you'll see a tab called "Libraries", if you look inside "Android Dependencies" you'll notice a list of jar's corresponding to your Library projects.
These jars are expandable, showing you that they have a slot for a source attachment. Usually this would be editable allowing you to directly link the source but in terms of ADT these are already filled and are uneditable.
When debugging these files you're linked to a read-only class file with this attached source. This is because you're not running against source files directly, you're running against a pre-compiled class file. Until the ADT team get this functionality in place, you're pretty much forced to jump to the direct source code and rebuild everything.
EDIT
See #Steven linked answer :)
I faced the same issue while debugging the a .java file using Eclipse IDE. As per my understanding this issue comes when we put the xyz.class file of xyz.java file or JAR at the project build path. Delete the .class or JAR file from the project class path and rerun .java file in the debug mode. This time you see a source not found window. Click on "Source not found" button and check "Find duplicates..." at the bottom of the window. Done your problem is solved :)
The problem is that the class file is preferred over the java (by default), here is how you can change that for Eclipse (tested on NEON 2):
Right-click on the Project in the Project-Explorer, click Properties
On the new window select: Run/Debug Settings
Create a new configuration (or duplicate another one)
Select the new config and click Edit...
Go to the tab Source
Select the Default and Remove
Create a new path with Add..., select Java Library, then JRE System Library
Create a new path with Add..., select the location where the sourcecode is by Workspace folder (if it is a project in the same workspace) or File System directory (it it is not)
I think this depends on, how you set up the dependency in eclipse. You should set up your BranchProject to depend on the source-Files of your MainProject. If you depend on compiles Class-Files is obvious that the debugger opens the class files, because it does not know about the source files.
I found a good solution for me here:
Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace
Simply, select each library project your project depends on, and use Top or Up to move it above the projects outputs. Eg. move all library projects to the top.
Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
Switch to Order and Export tab and uncheck Android Dependencies
Enjoy
If you tried all above hints and it still doesn't work try this solution, it worked form me:
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path...
Select tab Order and Export
select library that you can't reach code and then click on button Bottom
Then click on Apply and Close
hope this can help you
Most of the time it happens when specific source folder are not added in build path Sources tab.
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path -> Source Tab
Add the source folder if your project source folder is not there.
Select Add folder -> select your project source folder specifically. Eg: project_name/src . Then Apply it and restart server.

how to setup JDBC in Eclipse?

I have eclipse and j developer,I am more comfortable with eclipse.I want to know how to setup the JDBC driver in eclipse,I downloaded a driver from oracle.com but it does not appear anywhere when I browse after clicking 'external jars' in 'java build path' in "libraries" tab. My database is Oracle express edition.
Are there any good pdf's or tutorials for java application development?I want to make a front end application where I enter data into fields and it inserts into DB,and make it such that we can also retrieve information when we enter for example an ID.
What are the materials required for this?I don't want to learn too deep but I want to learn in the process(this is not a project just something I wanna achieve this month) so I am guessing i need
1. a book on awt,swing classes
2. I need to set this JDBC thing I don't understand how to get it up and running in eclipse,i type code it gives me error.
3.a book on how to connect java to oracle express edition DB.
I have JDK 1.7.0.0.3
Thanks in advance(i'm a beginner ;))
If you're wanting to include a JAR file to your Eclipse project, you would generally create a 'lib' folder inside the project folder, and put the file in there. You then need to tell eclipse to include it in your class path so your code will compile and run inside eclipse.
To do that:
- Go into the properties of your project
- Select 'Java Build Path' in the left hand column
- Select the 'Libraries' tab in the centre part of the window
- Click the Add JARs button - this will give you a list of your projects in eclipse - expand your project and into the lib folder - your jar will be there.
- Select the JAR, click OK, and OK again out of the properties window.
Or, you can just right-click the jar and click BuildPath->Add to Build Path.
Select the option of Add External Jar from the Build path and then browse to the location where the Jar is downloaded, select it and add it.
If you are not able to find the Jar while browsing through build path, check the location in windows explorer and confirm that it is where you are searching for it.
You asked how to "set up jdbc in eclipse". Here is my take on your question. If this isn't the answer to your question maybe it will help someone else.
Also - I'm using kepler eclipse. (really jboss dev studio version based on kepler)
First set up the driver.
Preferences -> Connectivity -> Driver Definitions
Click Add... and follow the prompts. You will be able to test the connection at this point. Eclipse makes it obvious how! (Click the Test connection button)
Close the Preferences window. In the main window
Window -> Show View... -> Data Source Explorer
Right click on Database Connections. Select New... and follow the prompts.
You'll be able to open the connection and browse your database.
As far as JPA-enabling your application, there may be a way to have eclipse set that up (ie right click on your project and maybe there is something in the context menu). It would set up a persistence.xml file in the right place and maybe other things. I don't know off the top of my head.
Hope this helps.
add a classnotfound exception. like this:
try {
Class.forName("com.mysql.jdbc.Driver");//the class driver
} catch (ClassNotFoundException e) {
e.printStackTrace();
}