Problems with webstart (ClassCastException java.applet.Applet)

I wrote a game (for the 4k competition) which extends a JFrame and contains a main method.
So far, I got a nice jar file (containing just one class file and the manifest) which can be started using: java -jar b.jar

Now, I would like to prepare that game for webstart (which as I understand works for application and applets, so I should be fine with my JFrame. Correct?).

First step: I sign my jar file without any problem. Observation: the jar file can no longer be executed because the jarsigner has deleted the Main-Class entry in my manifest. Is this normal?

Second step: I configured my web server correctly and uploaded a jnlp file.

Third step: I point my brwoser to that jnlp file and webstart tries to start my application.

I get the following error message:

java.lang.ClassCastException: B cannot be cast to java.applet.Applet
at com.sun.javaws.Launcher.executeApplet(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

What do I have to do differently to avoid this?

Thanks in advance,

Bruno

Could you post your JNLP, sounds like you’ve got the applet-desc tag in there instead of the application-desc ?

Kev

Yes, that was the problem … sort of.

I had changed it locally (from applet-desc to application-desc), but not on the webserver. I was running it locally using javaws … I did not think that it would get the web version.

So, here’s in short the solution (for all those out there googling) : when you get a ClassCastException cannot cast to java.applet.Applet make sure you used the tags application-desc and not applet-desc.

Thanks a lot,

Bruno