title: Resources with Eclipse and runnable Jar
body: <p>I've the following file structure:</p>
  
  <pre><code>+-src
    +-- code
  +-resources
    +-- img
      +- logo.png
    +-- defaultConfig
      +- config.xml
  </code></pre>
  
  <p>When i run the code in Eclipse it worked, since exporting to runnable jar, it haven't found the <code>defaultConfig</code> files</p>
  
  <p>I'm Accessing a Logo this way and it works</p>
  
  <pre><code>URL url = getClass().getResource("/img/logo.png");
  setIconImage(new ImageIcon(url).getImage());
  </code></pre>
  
  <p>Accessing the <code>config.xml</code> doesn't work with different set ups.</p>
  
  <p>this was given:</p>
  
  <pre><code>File config = new File("resources/defaultConfig/config.xml");
  </code></pre>
  
  <p>after a lot of searching i tried this one:</p>
  
  <pre><code>//example
  String path = "resources\\defaultConfig\\config.xml");
  File config = new File(createURIFromString(path));
  </code></pre>
  
  <p>I've tried it with <code>./</code> &amp; <code>.\</code> without <code>.</code></p>
  
  <pre><code>private URI createURIFromString(String path) {
      URI id = null;
      try {
          id =    getClass().getResource(path).toURI();
      } catch (Exception e) {
          e.printStackTrace();
      }
      return id;
  }
  </code></pre>
  
  <p>Result is a <code>null</code> Pointer.</p>
  
  <p>I've tried </p>
  
  <ul>
  <li>to add the folder to the resource dir</li>
  <li>to add the folder to the root dir (same layer like src)</li>
  <li>add the Config folder to the resource dir</li>
  </ul>
  
  <p><strong>Solution:</strong></p>
  
  <p>previously the file weren't in the jar, so till using the <code>getResorce</code> method, it works.</p>