title: How to get a String value of resources folder (Java)
body: <p>I'm a beginner in programming and I have a class that requires a path to some folder in its constructor. For example:</p>
  
  <pre><code> SomeClass class = new SomeClass(c:/folder);
  </code></pre>
  
  <p>I need to get a <code>String</code> value of <code>resources</code> folder (only path to folder without specific file names). A method in that class will add a filename to path from constructor and do some operations with a specific file.</p>
  
  <p>I'm trying to do this (bad code!), but just have <code>npe</code>:</p>
  
  <pre><code>ClassLoader classLoader = getClass().getClassLoader();
  File file = new File(classLoader.getResource("src/main/resources").getFile());
  String path = file.getAbsolutePath();
  </code></pre>
  
  <p>So, the question is: how to get <code>String</code> value of <code>resources</code> folder?</p>