title: Access is Denied in java.io.FileNotFoundException
body: <p>I'm using Eclipse, if that helps.</p>
  
  <p>I have to access files in java using a Scanner, and I'm using them to generate objects. Some of the objects have dependencies on other objects, and the program is supposed to call the appropriate "builder" method for these objects.</p>
  
  <p>For example, I have an <code>Effect</code> class, which is used by the <code>Weapon</code> and <code>Artifact</code> class, which are used by the <code>Enemy</code> class. </p>
  
  <p>The methods for generating these are called <code>effectBuilder(String fileName)</code>, <code>weaponBuilder(String fileName)</code>, etc. There's no issues with any of these methods but the <code>enemyBuilder(String fileName)</code> method, which gives me a <code>java.io.FileNotFoundException: .\doc\Builders (Access is denied)</code> error. The file location is where I'm keeping the text files for these methods. </p>
  
  <p>The enemyBuilder method is as follows:</p>
  
  <p>Class:</p>
  
  <pre><code>public static Enemy buildEnemy(String fileName)
  {
      Scanner sc;
  
      //creates Scanner, prints error and returns null if file is not found
  
      try {
          sc = new Scanner(new File("./doc/Builders/"+fileName));
      } catch (FileNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
      }
  
      //values are put into constructor at the end of the method.
  
      String n = sc.nextLine();
      int h = sc.nextInt();
      int d = sc.nextInt();
      int lo = sc.nextInt();
      int hi = sc.nextInt();
      String g = sc.nextLine();
  
      ArrayList&lt;Weapon&gt; weps = new ArrayList&lt;Weapon&gt;();
      while(!g.equals("a") &amp;&amp; sc.hasNextLine()){
          weps.add(Builder.buildWeapon(g));
          g = sc.nextLine();
      }
  
      ArrayList&lt;Artifact&gt; facs = new ArrayList&lt;Artifact&gt;();
      while(sc.hasNextLine()){
          facs.add(Builder.buildArtifact(sc.nextLine()));
      }
  
      sc.close();
  
      //converting for constructor purposes
  
      Weapon[] warr = new Weapon[weps.size()];
      int x = 0;
      for(Weapon e : weps)
          warr[x++] = e;
  
      Artifact[] aarr = new Artifact[facs.size()];
      x = 0;
      for(Artifact e : facs)
          aarr[x++] = e;
  
      return new Enemy(n, h, d, lo, hi, warr, aarr);
  }
  </code></pre>
  
  <p>The other <code>builder</code> methods do similar calls to other <code>builder</code> methods to create new objects, but this is the only one causing any problems.</p>
  
  <p>For reference, here is a sample of the txt file that is being used (The information in parenthesis details what variable the data should be used for):</p>
  
  <pre><code>Warrior (should be n)
  12 (should be h)
  10 (should be d)
  15 (should be lo)
  30 (should be hi)
  battleaxe.txt (first instance of g in 1st loop)
  longsword.txt (second instance)
  a (signifies the computer to move to next while loop)
  battlemedallion.txt (first instance of g in 2nd loop)
  chestplate.txt (second instance)
  </code></pre>
  
  <p>Is there a solution for this problem?</p>