title: Java File IO Write
body: <p>I cannot seem to write to a file. I create the file and directory successfully, and I don't hit any exceptions, yet when I open the file, it doesn't have any lines written to it.</p>
  
  <p>Is it possible that I need to somehow save changes to the file? Or is there some other way that I may not end up seeing the change, even though it has supposedly been made?</p>
  
  <pre><code>File stalkerFolder = new File("plugins/logs");
  File logFile = new File("plugins/logs/log.txt");
  FileWriter fw;
  FileReader fr;
  BufferedWriter writer;
  BufferedReader reader;
  boolean error = false;
  try{
      if(!folder.exists()){
          folder.mkdir();
      }
      logFile.createNewFile();
  }catch(Exception e){}
  try{
      fw = new FileWriter("plugins/logs/log.txt");
      fr = new FileReader("plugins/logs/log.txt");
      writer = new BufferedWriter(fw);
      reader = new BufferedReader(fr);
  } catch(Exception e){
      System.err.println("ERROR: CANNOT READ OR WRITE TO LOG FILE");
      System.err.println("Plugin terminated.");
      error = true;
  }
  
  System.out.println("writing to log");
  //Record to log
          try{
              writer.write("test log message");
          }catch(Exception e){
              System.err.println("could not write to log");
              e.printStackTrace();
          }
  </code></pre>
  
  <p>I do not get any errors printed out, and I DO reach "writing to log" successfully.</p>