title: Java FileNotFoundException although file is there
body: <p>I set up the method to try/catch this error. My issue is that it catches the fileNotFoundException for Trivia.txt even when I explicitly  created Trivia.txt in the same package. I can't figure out why the file is not being found. I did some looking around for the answer to my problem, and had no luck. Anyway, here's my code</p>
  
  <pre><code>public static void readFile(){
      try{
          File file = new File("Trivia.txt");
          FileReader fr = new FileReader(file);
          BufferedReader br = new BufferedReader(fr);
  
          while((line = br.readLine()) != null){
              System.out.println(line);
  
          }
  
          br.close();
  
      } 
      catch(FileNotFoundException e){
          System.out.println("file not found");
          System.out.println();
      }
      catch(IOException e){
          System.out.println("error reading file");
      }
  
  
  }
  </code></pre>
  
  <p>The code here is just a method of the TextHandler class that is called statically by WindowComp class (totally unrelated class). The package is mainPackage which holds the main() and WindowComp() and textHandler() alond with Triva.Txt</p>