hdfs 本地 winutils.exe (Could not locate executable null\bin\winutils.exe in t)

本文介绍了解决Hadoop环境下找不到winutils.exe的问题,包括如何下载winutils.exe并正确配置环境变量,确保Hadoop能在Windows系统上正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

下载 hadoop-common-bin 中含有 winutils.exe 

http://download.youkuaiyun.com/download/knight_black_bob/9722051 

 

 

 

hdfs  本地 (win) 报没有找到 winutils.exe 



 

 

严重: Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
	at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:278)
	at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:300)
	at org.apache.hadoop.util.Shell.<clinit>(Shell.java:293)
	at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:76)
	at org.apache.hadoop.conf.Configuration.getTrimmedStrings(Configuration.java:1546)
	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:519)
	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:453)
	at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:136)
	at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2433)
	at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:88)
	at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2467)
	at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2449)
	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:367)
	at com.curiousby.baoyou.cn.hadoop.HDFSUtils.init(HDFSUtils.java:65)
	at com.curiousby.baoyou.cn.hadoop.HDFSUtils.main(HDFSUtils.java:330)

 

 

 

 

hadoop 源码中 ,本地 hadoop 中没有 给出改 winutils.exe  

 

public static final String getQualifiedBinPath(String executable) 
  throws IOException {
    // construct hadoop bin path to the specified executable
    String fullExeName = HADOOP_HOME_DIR + File.separator + "bin"
      + File.separator + executable;
 
    File exeFile = new File(fullExeName);
    if (!exeFile.exists()) {
      throw new IOException("Could not locate executable " + fullExeName
        + " in the Hadoop binaries.");
    }
 
    return exeFile.getCanonicalPath();
  }
 
private static String HADOOP_HOME_DIR = checkHadoopHome();
private static String checkHadoopHome() {
 
    // first check the Dflag hadoop.home.dir with JVM scope
    String home = System.getProperty("hadoop.home.dir");
 
    // fall back to the system/user-global env variable
    if (home == null) {
      home = System.getenv("HADOOP_HOME");
    }
     ...
}

 

 

 

解决方法:

 

1.首先,下载一个 hadoop.tar.gz 解压后  ,设置 环境变量 :HADOOP_HOME   I:\software\hadoop-2.6.0\

 



 

2.下载 hadoop-common-2.2.0-bin ,因为 hadoop中也没有,该winutils.exe 文件,下载后,解压,将该文件复制到hadoop/bin下  

下载地址: http://download.youkuaiyun.com/download/knight_black_bob/9722051 

 

3.代码部分 文件前添加 System.setProperty("hadoop.home.dir", "I:\\software\\hadoop-2.6.0");

 

4.测试 ok



 

 

 

 

 

 

 

 

捐助开发者

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。



 
 谢谢您的赞助,我会做的更好!

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值