Hadoop错误:无法找到或加载主类类路径TestJava [英] Hadoop Error: Could not find or load main class class path TestJava

查看:144
本文介绍了Hadoop错误:无法找到或加载主类类路径TestJava的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Hadoop的新手,并且正在阅读《 Hadoop:权威指南》一书.我已经在Mac上安装了Hadoop,这似乎运行良好.我已经在HDFS(/user/nick)中设置了基本文件系统.但是我无法按照第3章(p 56)的要求使用"hadoop"命令来执行类文件.它似乎不是文件,因为"hadoop"命令即使在java命令可以正常工作的简单文件下也无法打开.这是我的终端对简单文件的外观:

I am new to Hadoop and am following the book Hadoop: The Definitive Guide. I have installed Hadoop on my mac, which seems to have worked fine. I have set up a basic file system in HDFS (/user/nick). But I can't get the 'hadoop' command to execute a class file as required in Chapter 3 (p 56). It doesn't seem to be the file because the 'hadoop'command won't open even a simple file where where java command works fine. This is what my terminal looks like for the simple file:

Unix〜/Desktop $ java TestJava

Unix ~/Desktop $ java TestJava

Hello Test World

Hello Test World

Unix〜/Desktop $ hadoop TestJava

Unix ~/Desktop $ hadoop TestJava

错误:找不到或加载主类TestJava

Error: Could not find or load main class TestJava

我尝试过的所有其他hadoop命令都可以正常工作(hadoop -ls,hadoop -copyFromLocal,hadoop -mkdir等),但是当类文件保存在桌面上时,hadoop CLASSNAME不起作用.我总是收到错误消息:无法找到或加载主类TestJava.

All the other hadoop commands I have tried work fine (hadoop -ls, hadoop -copyFromLocal, hadoop -mkdir etc), but hadoop CLASSNAME doesn't work when the class file is saved on the desktop. I always get Error: Could not find or load main class TestJava.

我将课程文件保存在错误的位置还是我设置的hadoop错误?

Am I saving the class file in the wrong place or have I set up hadoop wrong?

我对此并不陌生,已经在寻找答案,但是找不到解决方案.任何帮助将不胜感激.

I am new to this and have searched for an answer but couldn't find a solution. Any help would be much appreciated.

谢谢

尼克

推荐答案

您假设hadoop命令与java命令等效,但事实并非如此.基本上,您可以使用Hadoop命令运行Mapred,并在其中编写Mapper,Reducer(可选),驱动程序代码,然后创建一个jar文件,将所有这些文件并发出以下命令:

You are assuming hadoop command to be equivalent to java command which is not the case. Basically you run Mapred with Hadoop command where you write Mapper, Reducer(optional), Driver code and then you create a jar file will all these files and issue command like:

hadoop jar myjar.jar DriverClass inputInHdfs OutputPathInHdfs

您可以在此处

这篇关于Hadoop错误:无法找到或加载主类类路径TestJava的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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