![Page 2: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/2.jpg)
Platform
• Virtualbox 4.3.6
– CPU 1 core 8G RAM
– Ubuntu 12.04 server 64-bit
• Hadoop 1.2.1
![Page 3: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/3.jpg)
Outline
• Download Eclipse
• Import Hadoop to Eclipse
• Compile changed sources into jar
![Page 4: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/4.jpg)
Download Eclipse
• You should install java jdk first.
• google “eclipse download”
– http://www.eclipse.org/downloads/
– And download it.
![Page 5: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/5.jpg)
tar Eclipse
In terminal
Find the location you downloaded Eclipse
Usually in ~/Downloads
cd ~/Downloads
tar xvf eclipse*
and you’ll get a eclipse directory
move it under home
mv eclipse ~/
![Page 6: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/6.jpg)
Two ways to run EclipseNote: You should install JAVA first
By terminal:
~/eclipse/eclipse
By GUI:
double click
the icon
![Page 7: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/7.jpg)
• Selected the workspace of eclipse
• Just use default
![Page 8: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/8.jpg)
Import Hadoop
• First, get the source – http://ftp.twaren.net/Unix/Web/apache/hadoop/common
/hadoop-1.2.1/
– ftp://hadoop:[email protected]/hadoop-1.2.1.tar.gz
• tar it and move it under home, named as hadoop
![Page 9: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/9.jpg)
Build hadoop for eclipse
• sudo apt-get install ant autoconf libtool
• sudo aptitude install libtool
• cd ~/hadoop
• ant
• ant eclipse
![Page 10: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/10.jpg)
Eclipse ant setup
ANT_HOME
![Page 11: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/11.jpg)
Eclipse include tools.jar
![Page 12: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/12.jpg)
![Page 13: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/13.jpg)
Hadoop code style
Import the formatter from here
![Page 14: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/14.jpg)
Import hadoop project
![Page 15: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/15.jpg)
![Page 16: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/16.jpg)
Select the folder after tarwhich is ~/hadoop for our condition
![Page 17: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/17.jpg)
Compile changed hadoop
• As for example, we want to add message before jar.
• We modified the code org.apache.hadoop.util.RunJar.java
![Page 18: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/18.jpg)
Note: It should be System.err.println not System.out.println
![Page 19: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/19.jpg)
Generate new jar
• By using ant.
• In terminal
• cd ~/workspace/hadoop
• ant jar
• The new jar appears at ~/workspace/hadoop/build
• Since RunJar.java is a part of hadoop-core.jar, we only have to replace the hadoop-core.jar with new one.
![Page 20: Hadoop 1.2.1 compilation - University of Michigantimtu/site/share/hadoop_compile.pdf · 2018-09-14 · –Ubuntu 12.04 server 64-bit •Hadoop 1.2.1. Outline •Download Eclipse •Import](https://reader033.vdocument.in/reader033/viewer/2022043004/5f87b3235fbe730402192a9a/html5/thumbnails/20.jpg)
Hi Mom, it’s me