title: Tomcat cannot access files created by java API
body: <p>In process of creating a java based web application I have encountered this problem:  </p>
  
  <p>creating a new directory:  </p>
  
  <pre><code>Runtime.getRuntime().exec("mkdir /home/me/web/export"));
  </code></pre>
  
  <p>copying image:  </p>
  
  <pre><code>Runtime.getRuntime().exec("cp /home/me/images/a.jpg /home/me/web/export"
  </code></pre>
  
  <p>next I will create a download link to "a.jpg" in my JSP file. Until now everything works fine but when i deploy my webaplication on tomcat and try to download the file i get this message:  </p>
  
  <pre><code>Http Status 404 - The requested resource (/export/a.jpg) is not available.
  </code></pre>
  
  <p>I have checked the directory and the image is available there. One thing worth mentioning is that after I rename the image to for example 'b.jpg' and again rename it back to 'a.jpg', the link will work just fine.  </p>
  
  <p><b>Edit 1</b><br>
  This problem affects the files created by JAVA API as well. I used a Filewriter to create 'data.xml' in the same directory and I got the same page as before when I tried to access it through a link in JSP page.  </p>
  
  <p>I desperately tried to solve this problem by giving all available permissions to everyone 'chmod 777 file' without any success.</p>
  
  <p><b>Edit 2</b><br>
  I realized that after stopping the tomcat and restarting it everything goes back to normal and links are working fine now. I assume that tomcat somehow holds this newly created file so, all this said is there anything I can do to solve this?</p>
  
  <p><b>Final Edit:</b><br>
  This happens to be more of a server problem so it is logical to move it to ServerFault.<br>
  Thanks everyone for their responses.</p>