在Windows下的idea中訪問HDFS報錯 Could not locate executable null\bin\winutils.exe
18/09/08 20:18:33 ERROR 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:379) at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:394) at org.apache.hadoop.util.Shell.<clinit>(Shell.java:387) at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:80) at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2823) at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:2818) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2684) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:373) at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:162) at org.apache.hadoop.fs.FileSystem$1.run(FileSystem.java:159) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1698) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:159) at ls.hdfs.HDFSMain.main(HDFSMain.java:28)
解決方案:
在windows下解壓Hadoop按照包,並且把winutils.exe放入解壓包的bin目錄下
最後在程式配置一下環境變數即可
System.setProperty("hadoop.home.dir", "D:\\hadoop\\hadoop-2.7.3"); --------------------- 原文:https://blog.csdn.net/l1394049664/article/details/82532875?utm_source=copy