Hadoop报错java.lang.UnsatisfiedLinkError:org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String; I)Z

环境 Windows10 + IDEA2020.2专业版 + JDK8 + Hadoop2.6.0 报错信息 Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z 解决方案: 下载hadoop.dll点此去下载 以下方案依次尝试 放在hadoop根目录的bin目录下(本人实测,cmd命令行运行打包好的jar包需要这个) 放在c:/windows/System32下(IDEA需要这个) 参考: hadoop报错 java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Lja

2021-05-20 18:37:46 更新

Hadoop报错ERROR [org.apache.hadoop.util.Shell] - Failed to locate the winutils binary in the hadoop binary path

环境 Windows10 + IDEA2020.2专业版 + JDK8 + Hadoop2.6.0 报错信息 2020-12-03 14:37:52,196 WARN [org.apache.hadoop.util.NativeCodeLoader] - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 2020-12-03 14:37:52,202 ERROR [org.apache.hadoop.util.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. at org.apache.hadoop.util.Shell.getQualifiedBinPath(Shell.java:355) at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:370) 解决方法 下载winutils的windows版本,并放在%HADOOP_HOME%\bin下 设置环境变量,设置%HADOOP_HOME%为你的Hadoop根目录,并且Path中加入%HADOOP_HOME%\bin,之后重启idea 手动在代码中指定Hadoop根目录的位置(IDEA貌似必须这样,不知为何,而cmd命令行启动jar包只需要前两个就行了) System.setProperty("hadoop.home.dir", "你的Hadoop根目录,注意右斜线的转义"); 以上三个解决方案依次尝试即可。 参考: windows下运行spark程序报错:Failed to locate the winutils binary in the hadoop binary path

2021-05-20 18:37:46 更新