Windows本地执行MapReduce程序报错的解决办法
1、问题描述
在Windows系统上,本地执行MapReduce程序,报错:
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z
at org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Native Method)
at org.apache.hadoop.io.nativeio.NativeIO$Windows.access(NativeIO.java:606)
2、解决办法
将源码中的org.apache.hadoop.io.nativeio.NativeIO
复制到项目中,注意包名,并修改public static boolean access(String path, AccessRight desiredAccess) throws IOException
方法为:
public static boolean access(String path, AccessRight desiredAccess)
throws IOException {
String os = System.getProperty("os.name");
return os.contains("Windows") || access0(path, desiredAccess.accessRight());
}