title: No such file or directory found even though the file is in the same package
body: <p>I am trying to scan the <code>"loremIpsum.txt"</code> file to a String using the split method of the class String to store each word in a different position of an array, and last use a HashSet to find if there is any word repetition in the text. </p>
  
  <p>But Eclipse doesn't recognize the file even though it is in the same package. I was wondering if there is something wrong with my code?  </p>
  
  <pre><code>package Lab5;
  
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.HashSet;
  import java.util.Scanner;
  
  public class Lorem {
  
      public static void main(String[] args) {
          String[] loremIpsum = null;
          try {
              loremIpsum = new Scanner(new File("loremIpsum.txt")).next().split(" ");
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          }
  
          System.out.println(loremIpsum.length);
          HashSet h = new HashSet();
  
          for(int i=0;i&lt;loremIpsum.length;i++) {
              String word=loremIpsum[i];
              System.out.println(word);
              if(h.contains(word)) {
                  System.out.println("we found a duplicate");
              } else {
                  h.add(word);
              }   
          }
  
      }
  
  }
  </code></pre>
  
  <p>Error message and proof "lorem.txt" is in the same package:<br>
  <a href="https://i.stack.imgur.com/0KrBB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0KrBB.png" alt="error message and proof &quot;lorem.txt&quot; is in the same package"></a></p>