title: How to find a files path within a java web-service
body: <p>How can I find the path of my files that I have uploaded</p>
  
  <p>I am currently trying to return strings from text file through a restful web service. However I am unable to access the file path location when running the web project on a tomcat server. </p>
  
  <p>The file is contained in</p>
  
  <pre><code>Project root
  |_Java Resources
    |_package
        |_MyServiceClass.java
  |_ resources
     |_myText.txt
  </code></pre>
  
  <p>The service to be created is using javax and looks like</p>
  
  <pre><code>@GET
  @Produces(MediaType.TEXT_HTML)
  public String returnStriing() throws {
          String inputFileName  = "resources/myText.txt";
          File file = new File(inputFileName);
      }
  </code></pre>
  
  <p>The solution provided <a href="https://stackoverflow.com/questions/6893497/java-file-path-in-web-project">using</a> relative path did not work for me. How do I find the path of the file?</p>