title: Java text file not updating before opening
body: <p>So for a school project I need to save user account details in a text file, and if you login the program has to read from the text file to see if the user exists.</p>
  
  <p>Now the writing and reading works, but my problem is that the contents of the text file don't update until I open the file in eclipse.
  After I open the file I can see the new content suddenly appear in the file.</p>
  
  <p>This is my code right now:</p>
  
  <pre><code>        String path = context.getRealPath("/");
          path = path.substring(0, path.length() - 71);
          path = path + "\\v2iac14\\src\\main\\resources\\accountIDs.txt";
  
          File file = new File(path);
  
          if (!file.exists()) {
              file.createNewFile();
          }
  
          FileWriter fOut = new FileWriter(file, true);
          fOut.append("e:" + username + ";p:" + password + ";i:" + id + ";c:-----;");
          fOut.flush();
          fOut.close();
  </code></pre>
  
  <p>And how I read the file:</p>
  
  <pre><code>    InputStream inputStream = getClass().getClassLoader().getResourceAsStream("accountIDs.txt");
      String result = null;
      try {
          result = IOUtils.toString(inputStream);
      } catch (IOException e) {
          e.printStackTrace();
      }
      return result;
  </code></pre>
  
  <p>I already tried multiple methods of writing to the file but the problem stays the same..</p>