title: Loading Icon resource error
body: <p>In Eclipse, when I run the code, this works:</p>
  
  <pre><code>import javax.swing.ImageIcon;
  import javax.swing.JFrame;
  import javax.swing.JMenu;
  import javax.swing.JMenuBar;
  import javax.swing.JMenuItem;
  
  
     public class Main {
  
      public static void main(String[] args) {
  
          JFrame frame = new JFrame("test viewing images");
  
          frame.setSize(600,300);     
          frame.setLocationRelativeTo(null); // centered on monitor   
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
  
          /**
           * Menu Bar stuff
           */
  
          JMenuBar menuBar;
          JMenu menu;
          JMenuItem menuItem;
  
          // MENU BAR 
          menuBar = new JMenuBar();
          frame.setJMenuBar(menuBar);
          menuBar.setVisible(true);
  
          // MENU 1
          menu = new JMenu("File");
          menuBar.add(menu);
  
              // MENU 1 ITEM
              ImageIcon icon = new ImageIcon("src/Action-exit-icon.png");     
              menuItem = new JMenuItem("Exit Program", icon);
              menu.add(menuItem);
  
  
          frame.setVisible(true);
  
      }
  
     }
  </code></pre>
  
  <p>And here's the File Structure from my Package Explorer:</p>
  
  <pre><code>ShowImage (project)
   &gt; src / Main.java
   &gt; src / Action-exit-icon.png
  </code></pre>
  
  <p>Also, this workspace is located in Z:\eclipse_projects</p>
  
  <p>I can see the <strong>ImageIcon icon = new ImageIcon("src/Action-exit-icon.png");</strong> is working nicely, and the menuBar does it's job.</p>
  
  <p>Now let's Export this project, and I'll email the JAR to a friend of mine.</p>
  
  <ol>
  <li>Right-click project > Select Export</li>
  <li>Select Java > Runnable JAR File</li>
  <li>I choose the Main File in Launch configuration</li>
  <li>Export destination: my desktop</li>
  <li>Library handling:  Extract required libraries into generated JAR</li>
  <li>go to my desktop, double-click the ShowImage.jar</li>
  </ol>
  
  <p>The JFrame shows up, but the <strong>Action-exit-icon.png</strong> isn't appearing at all.</p>
  
  <p>When I open the ShowImage.jar, to view it's contents, I see the Main.class, Action-exit-icon.png, META-INF.</p>
  
  <p>Ok, I'm seriously confused about how to reference an image, or any resource now.
  What am I doing wrong?  </p>