0
以下是我的系統配置:windows8.1,vmware v12,2 centOS虛擬機。我在我的虛擬機上安裝了hadoop,其中一臺作爲主設備,另一臺作爲slave1。服務在兩個節點上正常運行並運行。編譯Hadoop wordcount教程 - hadoop 2.6.3
我想要編譯我的第一個MapReduce的程序,該單詞計數教程: 我嘗試使用編譯如下:
[[email protected] ~]$ javac -classpath $HADOOP_HOME/share/common/hadoop-common-2.6.3.jar:$HADOOP-HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.6.3.jar:$HADOOP_HOME/share/common/lib/common-cli-1.2.jar -d /home/hadoop *.java
,但我得到的答案是這樣的:
WordCount.java:4: error: package org.apache.hadoop.conf does not exist
import org.apache.hadoop.conf.Configuration;
^
WordCount.java:5: error: package org.apache.hadoop.fs does not exist
import org.apache.hadoop.fs.Path;
^
WordCount.java:6: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.IntWritable;
^
WordCount.java:7: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Text;
^
WordCount.java:8: error: package org.apache.hadoop.mapreduce does not exist
(.
.
.) ^
symbol: class Path
location: class WordCount
WordCount.java:58: error: cannot find symbol
FileOutputFormat.setOutputPath(job, new Path(args[1]));
^
symbol: variable FileOutputFormat
location: class WordCount
40 errors
我搜索了一下,大家都說這是因爲$ CLASSPATH。
這是我的/ etc /的.bashrc文件:
export JAVA_HOME=/opt/jdk
export JRE_HOME=/opt/jdk/jre
export PATH=$PATH:/opt/jdk/bin:/opt/jdk/jre/bin
export HADOOP_CLASSPATH=$JAVA_HOME/lib/tools.jar
export HADOOP_HOME=/opt/hadoop/
export CLASSPATH=$CLASSPATH:$HADOOP_HOME/share/common/hadoop-common-2.6.3.jar:$HADOOP-HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.6.3.jar:$HADOOP_HOME/share/common/lib/common-cli-1.2.jar
任何想法,爲什麼我得到這個錯誤?我看不出有什麼問題... :(
它的工作!謝謝soooooo多! –