2017-02-15 61 views
0

命令提交:Hadoop的java編譯器無法找到文件

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

看起來像你的類路徑不正確。您在每個圖書館的開始處都有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 
相關問題