title: Why does class.getResource() keep returning null although there is a resource at the specified path?
body: <p>I am wondering why the method <code>getResource</code> keeps returning <code>null</code>, I have the following setup:</p>
  
  <pre><code>public static URL getResource(String path){
      URL url = ResourceLoader.class.getResource(path);
      if (Parameters.DEBUG){
          System.out.println(path);
      }
      return url;
  }
  </code></pre>
  
  <p>My project structure in Eclipse is as follows:</p>
  
  <pre><code>-- res
    -- img
  </code></pre>
  
  <p>The <code>path</code> variable I pass to <code>getResource</code> has the value <code>"/res/img"</code> or <code>"/res/img/smile.png"</code>. Yet the method keeps returning <code>null</code> and <code>url</code> is not set. I also followed the instructions of <a href="https://stackoverflow.com/questions/12341348/java-class-getresource-with-eclipse">this question</a>, which were to add the folder to the project's <em>classpath</em> via <em>Run configurations</em>, still without success... Does anyone know what I am doing wrong?</p>
  
  <p><img src="https://i.stack.imgur.com/zU1Vp.png" alt="enter image description here"></p>