title: How to set the exact path to winutils.exe to access HDFS using Java?
body: <p>In my system variables, <code>HADOOP_HOME</code> is set to <code>C:\hadoop-2.7.2\bin</code></p>
  
  <p>I've tried to access HDFS using the following code:</p>
  
  <pre><code>FileSystem hdfs = FileSystem.get(new Configuration());
  Path homeDir = hdfs.getHomeDirectory();
  </code></pre>
  
  <p>Runtime Error:</p>
  
  <pre><code>17/03/13 10:49:39 ERROR util.Shell: Failed to locate the winutils binary in the hadoop binary path
  java.io.IOException: Could not locate executable C:\hadoop-2.7.2\bin\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.&lt;clinit&gt;(Shell.java:387)
      at org.apache.hadoop.util.StringUtils.&lt;clinit&gt;(StringUtils.java:80)
      at org.apache.hadoop.fs.FileSystem$Cache$Key.&lt;init&gt;(FileSystem.java:2823)
      at org.apache.hadoop.fs.FileSystem$Cache$Key.&lt;init&gt;(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.get(FileSystem.java:172)
  </code></pre>
  
  <p>How can I change the path accessed by my code <code>C:\hadoop-2.7.2\bin\bin\winutils.exe</code> to <code>C:\hadoop-2.7.2\bin\winutils.exe</code> as the former one isn't a valid directory?</p>