title: Resources and config loading in maven project
body: <p>I'm using Maven for desktop build application. I read about <a href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html" rel="nofollow noreferrer">Maven standard directory layout</a> and I have this project structure for now:</p>
  <pre><code>App
  |-- pom.xml
  `-- src
      |-- main
          |-- java
          |   `-- java classes
          |-- resources
          |   `-- images
          |       `-- app images
          `--config
             `--config.xml
  </code></pre>
  <p>I want to find a way to load my resources and config files. I read some articles and topics and found this (simplified example from my code):</p>
  <pre><code>//class for loading config
  public class Preferences {
      public Preferences() {
          InputStream image = Preferences.class.getResourceAsStream(&quot;images/image.png&quot;);
          InputStream config = Preferences.class.getResourceAsStream(&quot;config.xml&quot;);
      }        
  }
  </code></pre>
  <p>But image and config variables contains null. I was trying different variants of loading (from root folder, with this.getClass() instead of Preferences.class, and others), but it's always null. I really don't understand this resource loading system and I didn't find any good documentation about it. It would be nice, if somebody gives a good explanation about this mechanism (or just give a link on docs).
  So, the main question is: How can I load my resources and config files?</p>