title: Starting Java applet directly from jar file
body: <p>The goal is to have an applet run from a jar file.</p>
  
  <p>The problem is that the applet only seems to want to run from an exploded jar file.</p>
  
  <p>Samples on the Internet suggest this applet tag:</p>
  
  <pre><code>  &lt;applet code="com.blabla.MainApplet"
            archive="applet.jar"
            width="600" height="600"&gt;
  </code></pre>
  
  <p>This will not even try to look in the jar file and fails with:</p>
  
  <pre><code>Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/helloWord/com/blabbla/MainApplet.class
   at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   ... 7 more
  </code></pre>
  
  <p>Setting the codebase instead of the archive attribute to the jar file. Looks a bit better. However, the JVM does not realize that it has to open the jar file:</p>
  
  <pre><code>  &lt;applet code="com.blabla.MainApplet"
            codebase="applet.jar"
            width="600" height="600"&gt;
  
  
  Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/helloWord/applet.jar/com/blabbla/MainApplet.class
   at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
   at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   ... 7 more
  </code></pre>
  
  <p>How does the applet tag have to be formulated to start an applet class from <em>inside</em> of a jar file?</p>