title: Load file from resources by relative path (Spring)
body: <p>I have spring project.  My file here: /src/main/java/resources/file.txt.</p>
  
  <p>How I can get full path of this?</p>
  
  <p>If I run from test it works: </p>
  
  <pre><code>String path = System.getProperty("user.dir") + "/src/main/java/resources/file.txt";
  </code></pre>
  
  <p>But if I use tomcat, it shows another path inside tomcat folder. So spring cannot find this path.</p>
  
  <p><strong>EDIT:</strong> this.getClass().getClassLoader().getResource("file.txt") is null</p>
  
  <p><strong>UPDATED</strong>: sorry for stupid question. It works, I set wrong name of file.</p>