我如何运行Hadoop和Java类一起运行?

编程入门 行业动态 更新时间:2024-10-28 18:35:54
本文介绍了我如何运行Hadoop和Java类一起运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在阅读 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.txt

to 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.txt

Do you have hadoop home in your path? can you call hadoop without any parameters?

更多推荐

我如何运行Hadoop和Java类一起运行?

本文发布于:2023-10-28 02:41:25,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Hadoop   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!