title: Uncaught error fetching image in exported jar
body: <p>i have an application that loads an image to create a button with an icon in it. When started from the IDE, it works just fine, but when started from an exported jar file, it gives an image fetching error.</p>
  
  <p>Location of images : </p>
  
  <pre><code>+Project
     -Source Packages
        -Tools
           -start.jpg
  </code></pre>
  
  <p>The code used :</p>
  
  <pre><code>     static final String STARTIMAGE = "/Tools/start.JPG";
  
  public static JButton createStartButton() {
  
      Image img = Toolkit.getDefaultToolkit().getImage(GUITools.class.getResource(STARTIMAGE));
  
      JButton b = new JButton("",new ImageIcon(img));
      b.setPreferredSize(smallButton);
      b.setMaximumSize(smallButton);
      b.setMinimumSize(smallButton);
  
      return b;       
  </code></pre>
  
  <p>Now, the weirdest thing is that in another screen, a button is created in the exact same way, and this one works just fine...
  Code: </p>
  
  <pre><code>static final String PREVIOUSIMAGE = "/Tools/previous.gif";
  
  public JButton createPreviousButton(){
  
      Image img = Toolkit.getDefaultToolkit().getImage(getClass().getResource(PREVIOUSIMAGE));
      JButton b = new JButton("Previous",new ImageIcon(img));
      b.setPreferredSize(dimensionButton);
      b.setMaximumSize(dimensionButton);
      b.setMinimumSize(dimensionButton);      
  
      return b;       
  }
  </code></pre>
  
  <p>The only difference is that one is static, but even if make it non-static like the other one, it still won't work.</p>
  
  <p>I tried everything I found on this forum and other sites, including this good topic :</p>
  
  <p><a href="https://stackoverflow.com/questions/2273040/how-to-bundle-images-in-jar-file">How to bundle images in jar file</a>
  (The generated url at the end of the topic is just 'null')</p>
  
  <p>Nothing seems to work... Please help!</p>
  
  <p>Thanks!</p>