gpt4 book ai didi

ubuntu - hadoop Java编译器无法找到文件

转载 作者:行者123 更新时间:2023-12-02 21:04:54 25 4
gpt4 key购买 nike

提交的命令:

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

检查了目录后,commons * .jar和core * .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的新功能。

谢谢!!

最佳答案

看起来您的类路径不正确。您在每个库的开头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

关于ubuntu - hadoop Java编译器无法找到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42256720/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com