title: User entered file paths in Java
body: <p>I'm writing a text analyzer program that counts words and sentences etc. The user is asked to enter a file to analyze.</p>
  
  <p>Ex.</p>
  
  <p>"Enter a file to analyze : "
  "Enter : stuff.txt"</p>
  
  <p>I have the file saved in my project, but only works when I put the full file path, below is how it's handled. </p>
  
  <pre><code>public void loadFromFile(String filePath) {
        try {
               theText = new String(Files.readAllBytes(Paths.get(filePath)));
        } catch (Exception e) {
             System.out.println("could not load file " + filePath);
                 e.printStackTrace();
        }          
   } 
  </code></pre>
  
  <p>I want to simply write stuff.txt instead of the full file path </p>