Hadoop ClassPath单节点群集Mac OS

时间:2013-11-15 00:08:25

标签: java hadoop

需要一些帮助。虽然有很多不同的答案可供使用,但我也尝试过但却无法使用。我在我的mac os中本地调用了hadoop,当我尝试编译java程序时,我得到了以下错误。我知道问题在于设置正确的类路径,但在可能的情况下提供类路径并没有使它工作。我在/usr/local/Cellar/hadoop/1.2.1/libexec下安装了hadoop

我的java home设置为导出JAVA_HOME =“$(/ usr / libexec / java_home)” 和类路径设置为导出HADOOP_CLASSPATH = $ {HADOOP_HOME} / bin:$ {JAVA_HOME} / bin:$ {PATH}

但仍然遇到以下错误。任何有关设置正确类路径的建议都将受到赞赏。

LineIndexer.java:6:包org.apache.hadoop.io不存在 import org.apache.hadoop.io.LongWritable;                            ^ LineIndexer.java:7:包org.apache.hadoop.io不存在 import org.apache.hadoop.io.Text;                            ^ LineIndexer.java:8:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.FileInputFormat;                                ^ LineIndexer.java:9:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.FileOutputFormat;                                ^ LineIndexer.java:10:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.FileSplit;                                ^ LineIndexer.java:11:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.JobClient;                                ^ LineIndexer.java:12:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.JobConf;                                ^ LineIndexer.java:13:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.MapReduceBase;                                ^ LineIndexer.java:14:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.Mapper;                                ^ LineIndexer.java:15:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.OutputCollector;                                ^ LineIndexer.java:16:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.Reducer;                                ^ LineIndexer.java:17:包org.apache.hadoop.mapred不存在 import org.apache.hadoop.mapred.Reporter;                                ^ LineIndexer.java:21:找不到符号 符号:类MapReduceBase location:类LineIndexer   public static class LineIndexMapper扩展了MapReduceBase                                               ^ LineIndexer.java:22:找不到符号 符号:类Mapper location:类LineIndexer       实现Mapper {                  ^ LineIndexer.java:22:找不到符号 符号:类LongWritable location:类LineIndexer       实现Mapper {                         ^ LineIndexer.java:22:找不到符号 符号:类文本 location:类LineIndexer       实现Mapper {                                       ^

1 个答案:

答案 0 :(得分:0)

看起来你的类路径错了,试试这个:

javac -classpath /usr/local/cellar/hadoop-1.2.1/hadoop-core-1.2.1.jar

或者将您的HADOOP_HOME env变量重新定义为/usr/local/cellar/hadoop-1.2.1