File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Applet not Running! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet not Running!" Watch "Applet not Running!" New topic

Applet not Running!

Ritwick Pal

Joined: Nov 30, 2005
Posts: 13
I've an applet which I've tested in my local machine (with 'main') and it works fine. But whenever I'm trying to embed it in html, it doesn't appear and the console shows the following message:

~~~~~~~~~~~~~~~~~~~~~~~~~CONSOLE MESSAGE START~~~~~~~~~~~~~~~~~~~~~~~~~

Java Plug-in 1.5.0_10
Using JRE version 1.5.0_10 Java HotSpot(TM) Client VM
User home directory = F:\Documents and Settings\Archaeocodifix
network: Loading user-defined proxy configuration ...
network: Done.
network: Loading proxy configuration from Internet Explorer ...
network: Done.
network: Loading direct proxy configuration ...
network: Done.
network: Proxy Configuration: No proxy

basic: Cache is enabled
basic: Location: F:\Documents and Settings\Archaeocodifix\Application Data\Sun\Java\Deployment\cache\javapi\v1.0
basic: Maximum size: unlimited
basic: Compression level: 0

c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this 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>

basic: Registered modality listener
liveconnect: Invoking JS method: document
liveconnect: Invoking JS method: URL
basic: Referencing classloader: sun.plugin.ClassLoaderInfo@94948a, refcount=1
basic: Added progress listener: sun.plugin.util.GrayBoxPainter@1a0c10f
basic: Loading applet ...
basic: Initializing applet ...
basic: Starting applet ...
network: Connecting http://localhost/applet/whiteboard.class with proxy=DIRECT
basic: Cached file name: whiteboard.class-2a882c90-252685b6.class
network: Connecting http://localhost/applet/whiteboard$1.class with proxy=DIRECT
basic: Cached file name: whiteboard$1.class-1be2b69d-3997c409.class
network: Connecting http://localhost/applet/DrawingMouseListener.class with proxy=DIRECT
basic: Cached file name: DrawingMouseListener.class-3264434e-356a39b9.class
network: Connecting http://localhost/applet/MyWindowAdapter.class with proxy=DIRECT
basic: Cached file name: MyWindowAdapter.class-5f09963a-62dc8105.class
java.lang.ClassCastException: whiteboard
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at Source)
at Source)
basic: Exception: java.lang.ClassCastException: whiteboard

~~~~~~~~~~~~~~~~~~~~~~~~~CONSOLE MESSAGE END~~~~~~~~~~~~~~~~~~~~~~~~~

The JRE environment is also compatible. So can anyone enlight about the issue?

(If you require the code, just make a mention. I can give it in next post. I'm intentionally overlooking it in this post making the post less jumbled)
[ May 04, 2007: Message edited by: Ritwick Pal ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Does the whiteboard class extend Applet or JApplet?
Ritwick Pal

Joined: Nov 30, 2005
Posts: 13
Thanks Ulf for the reply.

This is the feedback you've requested:-

public class whiteboard extends Frame
Ritwick Pal

Joined: Nov 30, 2005
Posts: 13
This is another issue which I think may be important to you:

I cant change 'public class whiteboard extends Frame' to 'public class whiteboard extends Applet' for the following snippet in the code:

i) a] addWindowListener(new MyWindowAdapter());
b] class MyWindowAdapter extends WindowAdapter
public void windowClosing(WindowEvent we)
Ritwick Pal

Joined: Nov 30, 2005
Posts: 13
Many many thanks Ulf for pointing out the essential part.

I've changed 'public class whiteboard extends Frame' to 'public class whiteboard extends Applet' and sheded off the portion which was causing the trouble( as I had mentioned in earlier post). Now it works fine!

THANKS again!
I agree. Here's the link:
subject: Applet not Running!
It's not a secret anymore!