title: File Exists in Java?
body: <p>I trying to check whether a file exists at given directory location.</p>
  
  <pre><code>File seacrhFile = new File("D:/input", contract.conf);
  if (seacrhFile.exists()) {
    returnFile = seacrhFile;
  } else {
    System.out.println("No such file exists");
  }
  reutrn returnFile;
  </code></pre>
  
  <p>This is working in <code>D:/input</code> directory scenario, but if I Change the directory location to <code>src/test/resources/input</code> folder then I am getting <code>No such file exists</code>, eventhough the file exists.</p>