Run Your Map-Reduce code in Eclipse ( WordCount in Eclipse)

In this tutorial, We will see how to run/debug your Map-Reduce code in Eclipse.


My system Configuration:

sujit@sujit-pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:    trusty

sujit@sujit-pc:~$ java -version
java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)


sujit@sujit-pc:~$ hadoop version
Hadoop 2.7.1
Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r 15ecc87ccf4a0228f35af08fc56de536e6ce657a
Compiled by jenkins on 2015-06-29T06:04Z
Compiled with protoc 2.5.0
From source with checksum fc0a1a23fc1868e4d5ee7fa2b28a58a
This command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.7.1.jar

(I assume,  Java, Hadoop is installed and configured on your system)




Lets start with eclipse.

Download, Configure and start eclipse.
(if u don't have eclipse installed on your machine then click here )

Step 1: Create a Java Project in Eclipse.


 click on Finish

step 2:  For our Java project "WordCount"created in the earlier step, add the following Hadoop jars
 Right click on project-name i.e. WordCount  >> properties >> java build path >> libraries >> add external jars




Hadoop jars files are:

adding this much jars will help hadoop program to run/debug map-reduce code in eclipse.

Step 3: create WordCount.java file in src directory.

Step 4: Set up input and output

Right Click on WordCount.java file >> Run as >> Run Configuration >> Java Application >> argumets

Set input and Output:


Step 5: Run WordCount.java file. Done !!!!

(Every time you run your code, you need to delete output directory )