title: Exception in thread AWT-EventQueue-2 java.lang.NullPointerException
body: <p>I am trying to run a JApplet with jnlp.
  I have created my MyApplet which extends JApplet and packaged in a jar.
  I have also created MyApplet.jnlp and MyApplet.html
  My Runtime env is jdk 1.7.0.02.</p>
  
  <p>When I run it in a browser I get below exception from the browser, but my applet is running properly from the eclipse as a stand alone</p>
  
  <p>This is the exception I am getting</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
              at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$8.run(Unknown Source)
              at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.runOnEDT(Unknown Source)
              at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.resize(Unknown Source)
  </code></pre>
  
  <p>Please find my code below. This is the applet class which is running fine through Eclipse:</p>
  
  <pre><code>        import java.awt.Color;
          import java.awt.Container;
          import java.awt.Graphics;
  
          import javax.swing.JApplet;
          //This is my applet class
          public class MyApplet extends JApplet {
  
              private Container Panel;
          //constructor
                public MyApplet () {
                  super ();
                  Panel = getContentPane();
                  Panel.setBackground (Color.cyan);
                }
  
      //paint method
                public void paint (Graphics g) {
                  int Width;
                  int Height;
  
                  super.paint (g);
                  Width = getWidth();
                  Height = getHeight();
                  g.drawString ("The applet width is " + Width + " Pixels", 10, 30);
                  g.drawString ("The applet height is " + Height + " Pixels", 10, 50);
                }
  
          }
  </code></pre>
  
  <p>This is the html file, MyApplet.html:       </p>
  
  <pre><code>                &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;
                  &lt;html lang="en-US"&gt;
                    &lt;head&gt;
                      &lt;title&gt;My Applet Menu Chooser Applet&lt;/title&gt;
                      &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&gt;
                    &lt;/head&gt;
                    &lt;body&gt;
                      &lt;noscript&gt;A browser with JavaScript enabled is required for this page to operate properly.&lt;/noscript&gt;
                      &lt;h1&gt;Draggable Menu ChooserApplet&lt;/h1&gt;
                      &lt;p&gt;Press the &lt;b&gt;Left&lt;/b&gt; button on your mouse and drag the applet.&lt;/p&gt;
  
  
                      &lt;script src="http://www.java.com/js/deployJava.js"&gt;&lt;/script&gt;
                      &lt;script&gt;
                          var attributes = { code:'MyApplet', width:900, height:300 };
                          var parameters = {jnlp_href: 'MyApplet.jnlp', draggable: 'true'} ;
                          deployJava.runApplet(attributes, parameters, '1.6');
                      &lt;/script&gt;
                    &lt;/body&gt;
                  &lt;/html&gt;
  </code></pre>
  
  <p>MyAppletJnlp.jnlp</p>
  
  <pre><code>                &lt;?xml version="1.0" encoding="utf-8"?&gt; 
                  &lt;jnlp spec="1.0+"  href="MyApplet.jnlp"&gt;
                      &lt;information&gt;
                          &lt;title&gt;Jnlp Testing&lt;/title&gt;
                          &lt;vendor&gt;akash sharma&lt;/vendor&gt;
                          &lt;description&gt;Testing Testing&lt;/description&gt;
                           &lt;offline-allowed /&gt;
                          &lt;shortcut online="false"&gt;
                              &lt;desktop /&gt;
                          &lt;/shortcut&gt;
                      &lt;/information&gt;
  
                      &lt;security&gt;
                          &lt;all-permissions/&gt;
                      &lt;/security&gt;
                      &lt;resources&gt;
                          &lt;!-- Application Resources --&gt;
  
                                href="http://java.sun.com/products/autodl/j2se"/&gt;
                          &lt;jar href="MyApplet.jar" main="true" /&gt;
                      &lt;/resources&gt;
                      &lt;applet-desc 
                           name="Draggable Applet"
                           main-class="com.acc.MyApplet"
                           width="900"
                           height="300"&gt;
                       &lt;/applet-desc&gt;
                       &lt;update check="background"/&gt;
  
                  &lt;/jnlp&gt;
  </code></pre>