The main thing is to do a zip package of source files. And then attach it to eclipse to be OK.
I. Environmental description
System: Ubuntu 14.04 32 bit
Jdk:javac 1.7.0_75
Eclipse version::3.8.1
Hadoop version:2.4.1
Second, download and unzip the source code 1, download
: http://pan.baidu.com/s/1jGCGL98
Extract Password: Brup
2. Create a Directory
young@young-Lenovo-G470:~$ mkdir hadoop-srcyoung@young-Lenovo-G470:~$ cd hadoop-srcyoung@young-Lenovo-G470:~/hadoop-src$ mkdir org && mkdir org/apache && mkdir org/apache/hadoop
Copy the hadoop-2.4.1-src.tar.gz to the ~/HADOOP-SRC directory.
3. Decompression
young@young-Lenovo-G470:~/hadoop-src$ tar -xvf hadoop-2.4.1-src.tar.gzyoung@young-Lenovo-G470:~/hadoop-src$ lshadoop-2.4.1-src hadoop-2.4.1-src.tar.gz org
Third, packaging source
Because the source of Hadoop at this time is more dispersed, we will need to set up the source code into a. zip file attached to eclipse.
Copy some of the source code in the HADOOP-2.4.1-SRC (here only the MapReduce and HDFs related source code) to Org/apache/hadoop.
Young@young-Lenovo-G470: ~/hadoop-src$ Cp-r ~/hadoop-src/hadoop-2.4.1-src/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/ hadoop/* Org/apache/hadoop/young@young-Lenovo-G470: ~/hadoop-src$ Cp-r ~/hadoop-src/hadoop-2.4.1-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/* Org/apache/hadoop/young@young-Lenovo-G470: ~/hadoop-src$ Zip-r Hadoop-src.zip./org
Iv. Attaching to eclipse
Open Eclipse, right-click a project, build path, Configure build path, Add External JARs
Find the hadoop-src.zip that you just packed, check, OK.
V. Testing
Open a Hadoop project that contains the Reducer class, hold down CTRL, and click Reducer. If normal, you can see the beautiful source code.
Attachment
The following is my own good zip package, basically a complete Hadoop2.4.1 source package.
: HTTP://PAN.BAIDU.COM/S/1BNB9JTL
Extract Password: 3pmy
Welcome to the Csdn-markdown Editor