Failed to locate the winutils binary in the hadoop binary path

一、问题描述

win10环境下,intellj初次运行spark程序报错ERROR Shell Failed to locate the winutils binary in the hadoop binary path

image-20211028091940008

二、解决方案

前提下载好对应版本的winutils.exe并复制到hadoop的bin目录中,然后有以下三种解决方案:

① 系统设置环境变量HADOOP_HOME,并且重启intellj以应用

② 代码块最前面设定hadoop目录,System.setProperty("hadoop.home.dir","D:\\hadoop-3.2.0")

③ 在intellj运行配置中添加环境变量

image-20211028093018934

image-20211028093119415

image-20211028145647619

收工!