title: Applet trouble - NoClassDefFoundError
body: <p>I realize there's a million of these posts but none of them have helped me so here goes: I'm trying to deploy a very, very simple applet that will not load properly.
  My HTML: </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content"text/html; charset=utf-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;
     &lt;applet code = "SimpleApplet.class"
     width = "320" height = "100"&gt;&lt;/applet&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My Java: </p>
  
  <pre><code>package test;
  
  import javax.swing.*;   
  
  public class SimpleApplet extends JApplet{
     public void init(){
        try{
          SwingUtilities.invokeAndWait(new Runnable(){
            public void run(){
              JLabel lbl = new JLabel("Hello World");
              add(lbl);
            }
          });             
        }
        catch(Exception e){
          System.out.println(e);
        }
     }
  }
  </code></pre>
  
  <p>Both files are located in the same directory</p>
  
  <pre><code>/home/me/workspace/myProject/bin/test
  </code></pre>
  
  <p>If I run the applet on its own via Eclipse, it works fine. When I open the page I get the error </p>
  
  <pre><code>java.lang.NoClassDefFoundError: SimpleApplet (wrong name: test/SimpleApplet)
  </code></pre>
  
  <p>The error would suggest that I have incorrectly placed or named something. However, after trying</p>
  
  <pre><code>&lt;applet code = "test/SimpleApplet.class"
  width = "320" height = "100"&gt;&lt;/applet&gt;
  
  &lt;applet code = "SimpleApplet.class"
  codebase = "/test"
  width = "320" height = "100"&gt;&lt;/applet&gt;
  </code></pre>
  
  <p>along with other attempts, including removing the ", trying absolute and all partial path names, and using .java, it still does not work and I end up getting a ClassNotFoundException. <a href="https://stackoverflow.com/questions/11396646/load-class-myapplet-not-found-java-lang-classnotfoundexception-why-am-i-gett">Other</a> <a href="https://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java">answers</a> point out that classpath and codebase (often relating to archive) issues are a primary reason for this occurring. However, I am not using a jar file and both files are in the same directory. Anyone know why this is occurring?</p>