title: Getting Exception: "AWT-EventQueue-0" java.lang.NullPointerException
body: <p>I am getting the following exception</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
  at Java.CompileFile.doCompilation(CompileFile.java:48)
  at GUI.CompilerForm.compileBtnActionPerformed(CompilerForm.java:225)
  at GUI.CompilerForm.access$400(CompilerForm.java:23)
  ............
  </code></pre>
  
  <p>I no the error is at line 48 in CompileFile.java, it is saying that the array in NULL and i dont know why because that is where i am adding strings to it! </p>
  
  <pre><code>String[] compile;
  int numberOfErrors = 0;
  .
  .
  .
   for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {                
              String errors = diagnostic.getKind().toString()+" on line  "+ diagnostic.getLineNumber() +"\nIn file:  \n"+ diagnostic.toString();
              compile[numberOfErrors] = errors;
              numberOfErrors++;
          }
  </code></pre>
  
  <p>I have tried <code>System.out.println(errors);</code> straight after i set it and it is working fine so i really dont know what is going on!</p>
  
  <p>Any suggestions?</p>