无法编译 WordCount.java [英] Cannot Compile WordCount.java

查看:38
本文介绍了无法编译 WordCount.java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mark@maestro1:/usr/lib/hadoop/wordcount_classes$ javac -classpath /usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.1.jar:/usr/lib/hadoop/client/hadoop-mapreduce-client-core-2.0.0-cdh4.0.1.jar -d /usr/lib/hadoop/wordcount_classes /usr/lib/hadoop/wordcount_classes/WordCount.java
/usr/lib/hadoop/hadoop-common-2.0.0-cdh4.0.1.jar(org/apache/hadoop/fs/Path.class):     
warning: Cannot find annotation method 'value()' in type 'LimitedPrivate': class file for org.apache.hadoop.classification.InterfaceAudience not found
/usr/lib/hadoop/wordcount_classes/WordCount.java:14: error: error while writing Map: could not create parent directories
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
            ^
1 error
1 warning

这个错误是怎么回事?我无法编译这个 wordcount.java 文件!

what is with this error? I cannot compile this wordcount.java file!

人们一直告诉我正确设置我的 java 类路径.有人会对我如何处理这件事有任何评论吗?请帮忙!谢谢!

People have been telling me to set my java classpath correctly. Would anyone have any comment on how I go about this as well? Please help! Thanks!

推荐答案

这个

-d /usr/lib/hadoop/wordcount_classes

指示您希望将类文件写入何处.这样对吗 ?我怀疑你没有在那里写的权限,因此:

indicates where you want the class files written. Is this correct ? I suspect you don't have permission to write there, hence:

error while writing Map: could not create parent directories

您能否在该目录中创建一个目录(提示:使用 mkdir)?我不认为 /usr/lib 目录是执行此操作的好地方,顺便说一句,即使您可以.我希望您在您的主目录中执行开发.

Can you create a directory in that directory (hint: use mkdir) ? I don't think the /usr/lib directory is a good place to do this, btw, even if you can. I would expect you to perform development within your home directory.

/usr 目录通常用于安装程序、库等,对普通用户有写限制.man hier 很好地解释了 Unix 中使用的不同目录.

The /usr directory is usually used for installations of programs, libraries etc. and write-restricted for normal users. man hier gives a good explanation of the different directories used in Unix.

这篇关于无法编译 WordCount.java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆