java 包 org.apache.hadoop.fs 不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26723526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
package org.apache.hadoop.fs does not exist
提问by drjrm3
First, I KNOW THIS HAS BEEN ASKED BEFORE, but none of the solutions work for me and I would like to know why.
首先,我知道以前有人问过这个问题,但没有一个解决方案适合我,我想知道为什么。
I am trying to compile the standard 'WordCount.java' .jar for hadoop on my linux single-node cluster, but keep getting the package org.apache.hadoop.* does not exist
error.
我正在尝试在我的 linux 单节点集群上为 hadoop 编译标准的“WordCount.java”.jar,但不断收到package org.apache.hadoop.* does not exist
错误消息。
I know that I have to edit the $CLASSPATH, but everything I have found online is saying to reference hadoop-core
and I cannot find a hadoop-core
anywhere in my build (2.4.0). How do I find where org.apache.hadoop.* would exist on my system?
我知道我必须编辑 $CLASSPATH,但是我在网上找到的所有内容都是引用hadoop-core
,我hadoop-core
在构建 (2.4.0) 中找不到任何地方。我如何找到 org.apache.hadoop.* 在我的系统上存在的位置?
I feel this would be a good 'general' answer since I have seen many questions on this and everyone gives a specific /path/to/classpath/, but it is (apparently) different depending on version and build of hadoop.
我觉得这将是一个很好的“一般”答案,因为我已经看到很多关于这个的问题,每个人都给出了一个特定的 /path/to/classpath/,但它(显然)根据 hadoop 的版本和构建而不同。
回答by D'Nabre
As you said, the CLASSPATH you need depends on version, location, and type of installation. How to install it is a separate discussion, but assuming you have a proper hadoop setup installed, it's easy (though I admit, I have no clue where it is documented).
正如您所说,您需要的 CLASSPATH 取决于版本、位置和安装类型。如何安装它是一个单独的讨论,但假设您安装了正确的 hadoop 设置,这很容易(尽管我承认,我不知道它在哪里记录)。
Hadoop provides a convenient utility to get the CLASSPATH information you need. Run this
Hadoop 提供了一个方便的实用程序来获取您需要的 CLASSPATH 信息。运行这个
bin/hadoop classpath
This should give you the information you need set your classpath for compiling your code.
这应该为您提供设置类路径以编译代码所需的信息。