title: Running JUnit tests with Hadoop 2.2 on Windows 7
body: <p>I'm trying to run a simple JUnit test with Hadoop 2.2. on my Windows 7 machine.
  I have an exemplary test available at <a href="http://grepalex.com/2012/10/20/hadoop-unit-testing-with-minimrcluster/" rel="noreferrer">http://grepalex.com/2012/10/20/hadoop-unit-testing-with-minimrcluster/</a> so I'm using ClusterMapReduceTestCase as a base class to start the MiniDFSCluster.</p>
  
  <p>When running the test I'm getting (in console):</p>
  
  <blockquote>
    <p>2013-11-15 11:59:24,636 ERROR [main] util.Shell (Shell.java:getWinUtilsPath(303)) - 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:278)
        at org.apache.hadoop.util.Shell.getWinUtilsPath(Shell.java:300)
        at org.apache.hadoop.util.Shell.(Shell.java:293)
        at org.apache.hadoop.util.StringUtils.(StringUtils.java:76)
            (...)</p>
  </blockquote>
  
  <p>and in the JUnit output:</p>
  
  <blockquote>
    <p>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:435)
        at org.apache.hadoop.fs.FileUtil.canWrite(FileUtil.java:996)
        at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.analyzeStorage(Storage.java:451)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverStorageDirs(FSImage.java:282)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:200)
            (...)</p>
  </blockquote>
  
  <p>I've read the threads at: <a href="https://stackoverflow.com/questions/19620642/failed-to-locate-the-winutils-binary-in-the-hadoop-binary-path">Failed to locate the winutils binary in the hadoop binary path</a> and <a href="https://stackoverflow.com/questions/18630019/running-apache-hadoop-2-1-0-on-windows">Running Apache Hadoop 2.1.0 on Windows</a>
  I've also had a look at the possible solutions available at <a href="http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os" rel="noreferrer">http://www.srccodes.com/p/article/38/build-install-configure-run-apache-hadoop-2.2.0-microsoft-windows-os</a> and <a href="http://www.srccodes.com/p/article/39/error-util-shell-failed-locate-winutils-binary-hadoop-binary-path" rel="noreferrer">http://www.srccodes.com/p/article/39/error-util-shell-failed-locate-winutils-binary-hadoop-binary-path</a></p>
  
  <p>Unfortunately non of this works in case of JUnit tests. If I write junit tests I want them to be independent of the development environment (so that thye can run without problems on every developer machine). Therefore, I'm using maven and I don't want to build the required libraries on my own and put them in Hadoop bin folder, etc.</p>
  
  <p>Any sugestions what would be the best solution in this case?</p>