[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
courses:mapreduce-tutorial:step-21 [2012/01/26 23:28]
straka vytvořeno
courses:mapreduce-tutorial:step-21 [2012/01/31 11:18] (current)
straka
Line 1: Line 1:
-====== MapReduce Tutorial :  ======+====== MapReduce Tutorial : Preparing the environment ====== 
 + 
 +To use the Hadoop Java API, you must be able to compile the Java sources with the Hadoop library. An easy way is to use a prepared Makefile: 
 + 
 +  - Create a directory for the Java sources. 
 +  - Create a ''Makefile'' containing <file Makefile Makefile>include /net/projects/hadoop/java/Makefile</file> 
 + 
 +===== Compiling ===== 
 + 
 +When typing ''make'', every Java file is compiled (with the Hadoop library and some extra classes) to a jar file. It is of course possible to compile just selected sources using: 
 +  make ClassName1.jar ClassName2.jar 
 +or  
 +  make -f /net/projects/hadoop/java/Makefile ClassName1.jar 
 + 
 +Command ''make clean'' remove for every Java file its jar file and subdirectory with compiled classes. 
 + 
 +===== Exercise ===== 
 +Create a directory and a ''Makefile'' as described and download {{:courses:mapreduce-tutorial:step-21.txt|CompileTest.java}}. Try compiling it using ''make''
 + 
 +===== Using VIM ===== 
 +If you like using VIM, there is a special configuration available for editing Hadoop java files. Just execute 
 +  /net/projects/hadoop/bin/vim 
 +instead of ''vim''
 + 
 +This configuration of VIM has following features: 
 +  * Code completion is enabled for Java files. After pressing ''.'', list of members is displayed (if there are any). The code completion is not perfect, but works very well. 
 +  * VIM can run ''make''((The make command can be customized by '':set mp="make file.jar"'')) in the current directory by pressing F7 (both in normal and insert mode). The file being edited is automatically saved. Compilation errors and warnings are parsed. If there are no errors, the window with compilation errors is closed. If there are errors, the window with compilation errors is opened and the cursor is moved to the first error. 
 +  * The windows with compilation errors is opened/closed using F9. 
 +  * Pressing F11 / F12 goes to previous / next compilation error, if there are any. 
 +  * Key F8 opens a //taglist// -- small window with classes, fields and functions in the current file. 
 +  * Pressing ''\\'' comments/uncomments current (or selected) line. 
 + 
 +---- 
 + 
 +<html> 
 +<table style="width:100%"> 
 +<tr> 
 +<td style="text-align:left; width: 33%; "></html><html></td> 
 +<td style="text-align:center; width: 33%; "></html>[[.|Overview]]<html></td> 
 +<td style="text-align:right; width: 33%; "></html>[[step-22|Step 22]]: Optional – Setting Eclipse.<html></td> 
 +</tr> 
 +</table> 
 +</html>

[ Back to the navigation ] [ Back to the content ]