We can create and run the java Mapreduce programs in Eclipse as well as from command line.
Using Eclipse – For Eclipse first we have to install the plugin for hadoop mapreduce which inherits the libraries required to implement the mapreduce functionality. After this we have to build the path which includes various jar files that are required to run the mapreduce program.
After the setup follow these steps:
1.Create a new project
2.The in project src create a new package
3.The in package create 3 classes as below:
Right click of the package new->other->under mapreduce folder select mapper
Right click of the package new->other->under mapreduce folder select Reducer
Right click of the package new->other->under mapreduce folder select mapreduce Driver
Then write the code according to the functionality you want to achieve in these classes.
4. On Run tab click run configurations and in arguments tab give the arguments like filename and the directory name in which you want to store the program output.
5.Then click on run button.
In this way you can create and Run Hadoop program in Eclipse.
From command line – If you want to run the mapreduce program from command line you have to create the jar file of the program. We can create the jar file of the mapreduce program in following way:
In eclipse on the Driver class right click and then select export->under java select runnanble jar file->give exportDestination -> finish.
The Jar file is stored in the destination.
Now open the Terminal->
hadoop jar jarfilename.jar inputdirectoryname output-directoryname
Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at firstname.lastname@example.org
Leave A Comment