title: java.io.IOException: Permission denied on network folder
body: <p>i'm having the the post's title error when trying to write a file on a window folder , mounted on unix system. I've developed a web service which runs inside a Tomcat 6 on a linux os and need to write on a windows network folder. System administrators have mounted it on the Linux sever and have no problem to create and modify a file on it.
  When i try to execute the posted code i get the following exception :</p>
  
  <p>Permission denied
  java.io.IOException: Permission denied
          at java.io.UnixFileSystem.createFileExclusively(Native Method)
          at java.io.File.createNewFile(File.java:850)</p>
  
  <p>The weird thing is that it seems to be related to the File.createNewFile method on a network folder , in fact the service can write on local file system without problems, both on debug (the pc i use to develop the service) and a tomcat folder system administrators have provided me on the linux server. The file gets created but is empty and the log entry following the create method doesn't get printed. Moreover if i use a plain outputstream to create and write the file i've no problems.</p>
  
  <p>I cannot find any explanation about the exception on the web. Since i'm not very experienced with java , i'd like to understand why i'm getting this error. Am i using it in the wrong way ? Is it a bug of the library ? Do i miss to pass some parameter ? 
  As stated , i've solved the problem using a plain outputstream, this is a question to improve my understanding of java. </p>
  
  <pre><code>FileOutputStream fos = null; 
  try{ 
  
     log.info(String.format("file length: %s",streamAttach.length)); 
     log.info(String.format("check File : %s",filename)); 
     File f = new File(filename); 
     if(f.exists()) 
      ...                        
  
     boolean done= f.createNewFile();//here comes the exception
     //nothing of the following happens 
     if(!done) 
         throw new NWSException("error creating file"); 
     log.info(String.format("file %s creato", nomeFile)); 
  </code></pre>
  
  <p>thank you in advance for any answer</p>