title: Too many open files in Java
body: <p>i'm call this method several times:</p>
  
  <blockquote>
  <pre><code> private static void writeFile(double val, String myFile) throws IOException {
          FileWriter file = new FileWriter(myFile, true);
          file.write(val + "\n");
          file.close();
      }
  </code></pre>
  </blockquote>
  
  <p>After a periode i have this exception :</p>
  
  <blockquote>
  <pre><code>Exception in thread "main" java.io.FileNotFoundException: myFile (Too many open files)
  </code></pre>
  </blockquote>
  
  <p>How i can i resolve this exception please ?</p>