title: What should be my file path so it can find my text file?
body: <p>I'm creating a JAVA program to read a text file, but my function to open the file is not finding the file, this is my open and read file</p>
  <pre><code>public void openFile() {
      try {
          myReader = new Scanner(new File(&quot;C://Users//Desktop//CountInvTest1.txt&quot;));
      }
      catch(Exception e) {
          System.out.println(&quot;File not found&quot;);
      }
  }
  
  public void readFile() {
      
      while(myReader.hasNextLine()) {
          
          String data = myReader.nextLine();
          System.out.printf(&quot; &quot;, data);
      }
      
  }
  </code></pre>
  <p>I've changed the <code>myReader = new Scanner(new File(&quot;C://Users//Desktop//CountInvTest1.txt&quot;));</code> to <code>myReader = new Scanner(new File(&quot;CountInvTest1.txt&quot;));</code> and changed it to the path in the source folder in my project but still getting &quot;File not found&quot; from my try and catch. I've tried the file path with only one / but still the file is not found.
  What am I doing wrong?</p>