hadoop-2.2.0 경우는 이클립스에서 maven 으로 import 하면 됩니다만
hadoop-1.2.1 은 이클립스에서 ant 로 import 할 경우 ivy-common (??) 에러나면서 안됩니다.
그럴 경우 아래 방법을 참고하셔서 import 하시면 됩니다.
Basic Environment Description:
Service Release 1
Part 1: Building Hadoop Developing Environment
1) download hadoop source code.
2) Install tools.
- For Hadoop release, download it here. I used Hadoop 1.2.0;
- For Newest versions, it can be downloaded from Hadoop Version Control System;
- Assume HADOOP_HOME is the directory where the source code is.
3) Change configuration file of Hadoop
- Run command: sudo apt-get install ant ivy automake libtool to install "ant ivy automake libtool".
- Download forrest-0.8 and unzip it. Assume its directory is FORREST_HOME
Note that forrest-0.8 is not the latest version, Using the latest version may confront with some problems. In order to run forrest-0.8, we need java-1.5. Because we only need java-1.5 for forrest-0.8, we put java-1.5 in a separate directory. Assume it is JV5_HOME. The version I used is jdk1.5.0_22
4) Build hadoop.
- Open config file: $HADOOP_HOME/src/c++/task-controller/configure.ac
Find a line which contains AC_SYS_LARGEFILE, delete it.
- Open config file: $HADOOP_HOME/build.xml
Find a line contains < target name="ant-eclipse-download", there is a line closely below, start with < get src= which indicates the source location of file "ant-eclipse.jar". The location in my version does not exist, change it to https://ant-eclipse.googlecode.com/files/ant-eclipse-1.0.bin.tar.bz2.
5) Create eclipse project files.6) Configure eclipse and import hadoop project.
- cd $HADOOP_HOME
- ant compile
- ant clean package -Djava5.home=$JV5_HOME -Dforrest.home=$FORREST_HOME
- Open eclipse and add class path variable.
The operation is "Window->preferences->java->Buiid path-> Classpath Variables"
Create new variable ANT_HOME=/user/share/ant
- Import Hadoop project.
The operation is "File->Import->General->Existing Project Into Workspace". Goto $HADOOP_HOME and import the project
- Configure Hadoop project.
Because Hadoop need to find classes for webapp but these .Class files are not included in project configuration, it cause runtime errors.
A simple solution is adding path "$HADOOP_HOME/build/classes" to CLASS_PATH of the project. The operation is "File->Properties->Java Build Path->Libraries->Add Class Folder"
7) Test your environment
java 5 sdk 설치방법 (1)
java 5 sdk 설치방법 (2)
oracle 에서 5버전 bin 다운받은후 terminal 창에서
sudo chmod +x jdk-1_5_0_22-linux-amd64.bin (엔터)
sudo ./jdk-1_5_0_22-linux-amd64.bin (엔터)