title: Java Images not drawn when running java -jar
body: <p>I have a problem i have never had before and couldnt find a solution on the web.
  I have a small Programm which uses some images to print a menu.</p>
  
  <p>This is the Class i use to print the Images:</p>
  
  <pre><code>public class ViewImage extends JPanel {
      private static final long serialVersionUID = 1L;
      protected Image image = null;
  
      public ViewImage(int x, int y, String path) {
          this(x, y, new ImageIcon(path).getImage());
      }
  
      public ViewImage(int x, int y, Image image) {
          this.image = image;
          this.setBounds(x, y, image.getWidth(null), image.getHeight(null));
      }
  
      public void paintComponent(Graphics g) {
          int x = ((this.getWidth() - image.getWidth(null)) / 2);
          int y = ((this.getHeight() - image.getHeight(null)) / 2);
  
          g.drawImage(image, x, y, null);
      }
  
      public void setImage(String path) {
          this.image = new ImageIcon(path).getImage();
      }
   }
  </code></pre>
  
  <p>My Images are all part of the classpath an i call them with:</p>
  
  <pre><code>this.getClass().getClassLoader().getResource("MyImage.png").getPath()
  </code></pre>
  
  <p>Works fine until i package my programm into a jar file and run 
  it from console with:</p>
  
  <pre><code>java -jar MyJar.jar
  </code></pre>
  
  <p>My programm starts well but no image are printed. No Exceptions, no Errors, 
  nothing.</p>
  
  <p>What can cause such an behaviour?</p>