Applet failed problem
Hi!
Im new to working with Java applets. I am going to describe my problem with the applet I have written and all the circumstances of it because maybe I have missed out some little detail that somebody can point out.
So, I was given the assignment of modifying my Professor's applet a little bit. The structure of the code was class example1 extends class table extends class BufferedApplet. I made the changes to the applet using Netbeans IDE 4.1. So the applet runs perfectly in the applet viewer, and the HTML page created by the netbeans on running the example1.java code also works fine if I open it from the build folder using firefox, or explorer.
So I thought, great, I got my assignment done. We must post the applet on our website for it to get graded. So I uploaded the example1.class file and the example1.html file to the same directory on the webpage. I added table.class and BufferedApplet.class as well, just to be safe. All three source files are also in the same directory, coz we have to provide links to them for the assignment.
Now, when I open the webpage, it wont display the applet. It shows me a white box with a red cross in the top left corner and gives me the message "loading java applet failed". sometimes, there are variations like "example not inited" or "java.lang.NullPointerException"... Here is what the Sun Java console had to say:
Java Plug-in 1.5.0_04
Using JRE version 1.5.0_04 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Vidya at work
-
c:clear console window
f:finalize objects on finalization queue
g:garbage collect
h:displaythis help message
l:dump classloader list
m:print memory usage
o:trigger logging
p:reload proxy configuration
q:hide console
r:reload policy configuration
s:dump system and deployment properties
t:dump thread list
v:dump thread stack
x:clear classloader cache
0-5: set trace level to <n>
-
java.lang.NoClassDefFoundError: example1 (wrong name: multimedia/example1)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread"Thread-4" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread"thread applet-example1.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NoClassDefFoundError: example1 (wrong name: multimedia/example1)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have been trying to find solutions to this problem for weeks now.... Please help!!!!
Here is my html page....
<HTML>
<HEAD>
<TITLE>Modified Test Environment</TITLE>
</HEAD>
<BODY bgcolor=black text=white link=white alink=white vlink=white>
<!--
*** GENERATED applet HTML launcher - DO NOT EDIT IN'BUILD' FOLDER ***
If you need to modifythis HTML launcher file (e.g., to add applet parameters),
copy it to where your appletclass is found in the SRC folder. If youdo this,
the IDE will use it when you run or debug the applet.
Tip: To exclude an HTML launcher from the JAR file, use exclusion filters in
the Packaging page in the Project Properties dialog.
For more information see the online help.
-->
<H3>Modified Test Environment</H3>
<center>
<APPLET codebase="." code="example1.class" width=500 height=500></APPLET>
</center>
<P>
Source: <a href=example1.java>example1</a>extends <a href=table.java> table</a>extends <a href=BufferedApplet.java>BufferedApplet</a>
</P>
</BODY>
</HTML>
??

