title: Is it possible to write to a hidden file in Java?
body: <p>I have figured out how to create a hidden file in Java, now I need to write large amounts of data to the file. I keep getting the following exception:<code>SEVERE: java.io.FileNotFoundException: &lt;filepath&gt;\tmp (Access is denied)</code></p>
  
  <p>Here are two approaches I took to get try and get a solution, but I get the same exception for both approaches. Note: toOverwrite is the hidden file in both cases.</p>
  
  <pre><code>File fileByteText = new File("./testFile.txt");
  File toOverwrite = new File("./tmp");
  //Assume toOverwrite is hidden
  
  boolean toReturn = true;
      try {
          byte[] fileByteText = FileUtils.readFileToByteArray(toGetTextFrom);
                      FileUtils.writeByteArrayToFile(toOverwrite, fileByteText,    false);
                      toReturn = false;
                  } catch (IOException e) {
                      bam.severe(e);
                      toReturn = true;
                  }
  </code></pre>
  
  <p>Approach two using the same file objects:</p>
  
  <pre><code>try {
                  String fileText = FileUtils.readFileToString(toGetTextFrom);
                  FileWriter fw = new FileWriter(toOverwrite.getAbsoluteFile());
                  BufferedWriter bw = new BufferedWriter(fw);
                  bw.write(fileText);
                  bw.close();
                  toReturn = false;
              } catch (IOException e1) {
                  bam.severe(e1);
                  toReturn = true;
              }
  </code></pre>