我正在阅读 Hadoop:权威指南一书。
我对示例3-1感到困惑。
有一个Java源文件URLCat.java。 我使用 javac 将其编译到URLCat.class中,然后使用 jar 将其包装到jar中。
本书说使用
%hadoop URLCat hdfs: //localhost/user/tom/quangle.txt来运行它。我尝试了很多不同的方法,比如
%hadoop jar URLCat.jar .......但没有用。我有这样的错误:
线程main中的异常java.lang.ClassNotFoundException:hdfs:// localhost / user / username / quangle / txt
这是什么原因,以及如何正确使用它?
解决方案>语法的命令有点不同:
hadoop fs -cat hdfs:/// user / tom / quangle.txt你有回家的路程吗?你可以不带任何参数调用hadoop?
I am following the book Hadoop: the definitive Guide.
I am confused on example 3-1.
There is a Java source file, URLCat.java. I use javac to compile it into URLCat.class, then use jar to wrap it into a jar.
The book said to use
% hadoop URLCat hdfs://localhost/user/tom/quangle.txtto run it. I have tried a lot of different ways, such as
% hadoop jar URLCat.jar .......but didn't work. I got errors like this:
Exception in thread "main" java.lang.ClassNotFoundException: hdfs://localhost/user/username/quangle/txt
What is the reason for this, and how do I do it right?
解决方案The syntax of the command is a little bit different:
hadoop fs -cat hdfs:///user/tom/quangle.txtDo you have hadoop home in your path? can you call hadoop without any parameters?
更多推荐
我如何运行Hadoop和Java类一起运行?
发布评论