sisi
02-15-2010, 05:58 PM
I have been using NetBeans 6.7.1 to develop a JApplet and had an HTML document in the same folder where my Applet.java file was. The HTML page loading this applet had an attribute in the specific APPLET tag which specified the CODEBASE of the corresponding created Applet.class, which used to be ..\..\build\classes. So the whole thing was working like this. However, I recently tried to run the same project but the Applet was not loaded and the following error was given:
java.lang.NoClassDefFoundError: Applet (wrong name: pls/Applet)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.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.NoClassDefFoundError: Applet (wrong name: pls/Applet)
I must mention that I have checked if the thing was misspelled or smth. but it is correct. However I have noticed that recently the structure of files of the classes stored in NetBeans which used to be build/classes is now changed. I have modified the codebase attribute in the applet correspondingly but still the same problem. I have even placed the HTML in the same folder where the classes are located in NetBeans (in my case build\classes\pls) and removed the CODEBASE attribute but still it presents the same error and it is not working. I am suspecting that it has to do with some updates. Also, the same code works when copied to and compiled with TextPad (of course without the package declaration, but having the same structure of folders as in NetBeans only created on my Desktop). So it has probably smth. to do with NetBeans I think. Therefore, if someone has any idea why this might be happening and how to solve it, please write back. I am waiting forward for your responses. Thank you all beforehand!
java.lang.NoClassDefFoundError: Applet (wrong name: pls/Applet)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.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.NoClassDefFoundError: Applet (wrong name: pls/Applet)
I must mention that I have checked if the thing was misspelled or smth. but it is correct. However I have noticed that recently the structure of files of the classes stored in NetBeans which used to be build/classes is now changed. I have modified the codebase attribute in the applet correspondingly but still the same problem. I have even placed the HTML in the same folder where the classes are located in NetBeans (in my case build\classes\pls) and removed the CODEBASE attribute but still it presents the same error and it is not working. I am suspecting that it has to do with some updates. Also, the same code works when copied to and compiled with TextPad (of course without the package declaration, but having the same structure of folders as in NetBeans only created on my Desktop). So it has probably smth. to do with NetBeans I think. Therefore, if someone has any idea why this might be happening and how to solve it, please write back. I am waiting forward for your responses. Thank you all beforehand!