5 Replies Latest reply on May 10, 2012 1:37 AM by 935964

    Class Not Found Exception - applet won't run anywhere outside of IDE

      I have an applet that runs perfectly in the netbeans IDE, but won't run from command prompt (I'm using windows) or from a browser. I've been banging my head against the wall for a few days on this one. Here's the HTML I'm using:

      <applet width="400" height="525" code="musicapplet.class" archive="crypticgraffiti.jar">
      <param name="bgcolor" value="ffffff"> <param name="fontcolor" value="000000">
      </param> </param> Your browser is not Java enabled. </applet>

      Here is the structure of the jar file's contents:


      (Musicapplet.class is the main class)

      When I attempt to run from command prompt, I get:

      "Error: Could not find or load main class crypticgraffiti.MusicApplet"

      When I attempt to load via html:

      "basic: load: class musicapplet.class not found.
      load: class musicapplet.class not found.
      java.lang.ClassNotFoundException: musicapplet.class
           at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
           at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
           at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
           at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
           at java.lang.ClassLoader.loadClass(Unknown Source)
           at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
           at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
           at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
      Exception: java.lang.ClassNotFoundException: musicapplet.class
      security: Accessing keys and certificate in Mozilla user profile: null"

      I have tried every possible variation for the 'code' element of the applet tag (package.mainclass.class, mainclass, mainclass.class, etc). I have also tried compiling with JDK 1.6 and this didn't change anything. I've tried clearing out the cache of temporary files using the java control panel settings, and have verified that my browser can run other applets using JRE 6 and 7.

      I've tried some different ways of distributing the applet, also: putting all the class files in the folder with the html file, putting the classes in a source folder in the same folder as the html file, and finally putting a jar in the same folder as the html file (which really seems the simplest).

      Any help at all would be most appreciated! This applet is a very cool and original music creating app that draws heavily on the JFugue API. It's a shame that I can't get it online for people to play with!