title: org.apache.hadoop.mapred.FileAlreadyExistsException in Amazon EMR
body: <p>I am trying to run WordCount program in Amazon EMR but I got the error saying :</p>
  
  <pre><code>Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory s3://mywordcountbuckett/run0 already exists
      at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:146)
      at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:562)
      at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:432)
      at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1296)
      at org.apache.hadoop.mapreduce.Job$10.run(Job.java:1293)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:415)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
      at org.apache.hadoop.mapreduce.Job.submit(Job.java:1293)
      at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1314)
      at wordcount.WordCount.main(WordCount.java:70)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
      at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bmgFX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmgFX.jpg" alt="enter image description here"></a></p>
  
  <p>I have tried to Google the solution online and came across the solution which advised like this</p>
  
  <pre><code> The work around this is to not output to the top level of your bucket. So for instance "s3n://test.output/run0".
  </code></pre>
  
  <p>I have tried but still not working.</p>