当想在Windows上运行Spark本地模式测试代码的时候会报如下错误ERROR Shell: 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.
主要是找不到winutils
解决办法:
1.将Windows的hadoop安装介质的zip包解压到本地目录
2.在程序中指定环境变量
def main(args: Array[String]): Unit = {
//!!!注意:如果在Windows上执行,指定Hadoop的Home
System.setProperty("hadoop.home.dir", "D:\\temp\\hadoop-2.4.1\\hadoop-2.4.1")
//程序
}