title: Java open file error: can't find the specified path
body: <p>I try to open a .txt file (agenda.txt) from the src/resources folder, read objects from it and add them to an ArrayList, but I get this error: "The system can not find the specified path.". This is the code I use:</p>
  
  <pre><code>    public void open(File f) {
      FileInputStream fis = null;
      ObjectInputStream ois = null;
      try {
          fis = new FileInputStream(f);
          ois = new ObjectInputStream(fis);
          Object o;
          try {
              while ((o = ois.readObject()) != null) {
                  model.adauga((Abonat) o);
              }
          } catch (ClassNotFoundException ex) {
              JOptionPane.showMessageDialog(
                      this,
                      ex.getMessage(),
                      "Clasa...!",
                      JOptionPane.ERROR_MESSAGE);
              return;
          }
      } catch (IOException ex) {
          JOptionPane.showMessageDialog(
                  this,
                  ex.getMessage(),
                  "Eroare deschidere fisier!",
                  JOptionPane.ERROR_MESSAGE);
          return;
      } finally {
          try {
              ois.close();
          } catch (IOException ex) {
              Logger.getLogger(CarteDeTelefonGUI.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  
  
  }
  </code></pre>
  
  <p>And in the class constructor:</p>
  
  <pre><code>    private String path ="resources/agenda.txt";
      File f=new File(path);
      open(f);
  </code></pre>
  
  <p>What is wrong in the code?</p>