title: Jar file failing to execute with NullPointerException when it runs fine unpacked
body: <p>I'm attempting to restructure a legacy application and reduce the steps needed to deploy.
  To do this, I'm packaging all the class files, and Resources into a jar file.</p>
  
  <p>I'm using this command to jar everything:</p>
  
  <blockquote>
    <p>jar -cfm ../Deploy/JEmu.jar Manifest.txt *.class Resources/</p>
  </blockquote>
  
  <p>My manifest file looks like this:</p>
  
  <pre><code>Manifest-Version: 1.0  
  Created-By: 1.2.2 (Sun Microsystems Inc.)  
  Main-Class: JEmu  
  Name: JEmu.class  
  </code></pre>
  
  <p>The class that is the entry point is JEmu.class, which is packaged in the jar, but when I run the jar I get this error:</p>
  
  <pre><code>java -jar JEmu.jar
  Exception in thread "main" java.lang.ExceptionInInitializerError
  Caused by: java.lang.NullPointerException
          at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source)
          at ControlBar.&lt;init&gt;(ControlBar.java:88)
          at JEmu.&lt;clinit&gt;(JEmu.java:85)
  Could not find the main class: JEmu. Program will exit.
  </code></pre>
  
  <p>I'm not exactly sure what is causing that.</p>
  
  <p>Line 88 of ControlBar is:</p>
  
  <pre><code>stopButton = new JButton( new ImageIcon( classLoader.getResource("Resources/stop.gif")));
  </code></pre>
  
  <p>What am I doing wrong, it all works when it's not packaged into a jar?</p>