title: Once exported, java cannot find/draw images
body: <p>Hello stackoverflowites, </p>
  
  <p>I am in the process of developing a 2d game, and when I run it inside of eclipse, my program loads all of it's images and resources fine. However, I am using the not-necessarily-recommended way of creating my images and image icons, which is shown below:</p>
  
  <pre><code>bannerLogo.setIcon(new ImageIcon("/res/client/BannerHeader.jpg"));
  </code></pre>
  
  <p>Now, when exporting to a jar, it does not show the image (which is expected since im not using the correct way.) </p>
  
  <p>I searched for the correct way to do it, which I found was:</p>
  
  <pre><code>URL imgURL = getClass().getResource("/res/client/BannerHeader.jpg");
  Image bannerImg = Toolkit.getDefaultToolkit().getImage(imgURL);
  bannerLogo.setIcon(new ImageIcon(bannerImg));
  </code></pre>
  
  <p>And that didn't work either, I get an "Uncaught error fetching image: " trace, which just tells me that my URL (imgURL) is null. (This is when I run inside of eclipse, mind you, I havn't even exported it yet)</p>
  
  <p>I figure it has something to do with my classpath,however I cannot figure out what.</p>
  
  <p>Inside of eclipse, my package structure is as follows:</p>
  
  <p>(Parent Directory, project name)</p>
  
  <p>+src folder, has normal packages, etc, on build path</p>
  
  <p>+resource folder, ("res"), not on build path (tried it on build path, nothing changed)</p>
  
  <p>+++subdirectories of resource folder</p>
  
  <p>Im at a loss of what to do here guys. Sorry for the wall of text. </p>