This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet not Running!

 
Ritwick Pal
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the whiteboard class extend Applet or JApplet?
 
Ritwick Pal
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic