• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Applet not Running!

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
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 sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown 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 ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the whiteboard class extend Applet or JApplet?
 
Ritwick Pal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf for the reply.

This is the feedback you've requested:-

public class whiteboard extends Frame
 
Ritwick Pal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
{
System.exit(0);
}
}
 
Ritwick Pal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic