命令已提交:
javac -classpath usr/local/hadoop/share/hadoop/tools/lib/hadoop-core-0.20.204.0.jar:usr/local/hadoop/share/hadoop/tools/lib/commons-cli-1.2.jar -d compiled_programs grep_example/WordCount.java > out 2>error
已查看目录,两个公共* .jar和核心* .jar存在于指定目录中。
错误:
grep_example/WordCount.java:4: error: package org.apache.hadoop.conf does not exist
import org.apache.hadoop.conf.Configuration;
^
grep_example/WordCount.java:5: error: package org.apache.hadoop.fs does not exist
import org.apache.hadoop.fs.Path;
^
grep_example/WordCount.java:6: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.IntWritable;
^
grep_example/WordCount.java:7: error: package org.apache.hadoop.io does not exist
import org.apache.hadoop.io.Text;
^
grep_example/WordCount.java:8: error: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Job;
^
grep_example/WordCount.java:9: error: package org.apache.hadoop.mapreduce does not exist
import org.apache.hadoop.mapreduce.Mapper;
我做错了什么? Ubuntu和Hadoop都是新手。
谢谢!
答案 0 :(得分:0)
看起来你的类路径不正确。你在每个图书馆的起点usr/..
。它应该是/usr/..
正确的命令:
javac \
-classpath /usr/local/hadoop/share/hadoop/tools/lib/hadoop-core-0.20.204.0.jar:/usr/local/hadoop/share/hadoop/tools/lib/commons-cli-1.2.jar \
-d compiled_programs \
grep_example/WordCount.java \
> out 2> error