title: AccessControlException while parsering an XML file using JAVA DOM
body: <p>Okay so I was parsering an XML file using JAVA DOM.
  Whenever the program gets to the point where it is supposed to parser the XML file, I get a "AccessControlException" saying "access denied".
  I have parsered many XML files using JAVA DOM and this is the first time I have gotten this exception.
  What am I doing wrong?</p>
  
  <p>Here is the XML file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;root&gt;
  
  &lt;/root&gt;
  </code></pre>
  
  <p>Here is the code that is supposed to parser it:</p>
  
  <pre><code>DocumentBuilderFactory bdf = DocumentBuilderFactory.newInstance();
          DocumentBuilder bd = bdf.newDocumentBuilder();
          Document doc = bd.parse("excersize.xml");
  </code></pre>
  
  <p>Finally here is the error I get:</p>
  
  <pre><code>java.security.AccessControlException: access denied ("java.io.FilePermiss
  ion" "\excersize.xml" "read")
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>Luckily after some time I got it to work using a policy file however for whatever reason it only works if I type the full directory of the xml file</p>
  
  <p>This <em>works</em>:</p>
  
  <pre><code>Document doc = builder.parse("file:/B:/Programming/Java/Programs/new/excersize.xml");
  </code></pre>
  
  <p>but this <em>doesn't</em>:</p>
  
  <pre><code>Document doc = builder.parse("excersize.xml"); //The xml file is in the same directory as the java source file, the class file, and the html file
  </code></pre>
  
  <p>although this is tolerable, I do like to keep my files "mobile ready" so that they don't have any concrete adresses but rather adresses relative to the .java and .class file. Any help at all to help me figure out this problem would be greatly appreciated :)</p>