Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

launching a package piece 1

Status
Not open for further replies.

grummbunger

Technical User
Oct 2, 2003
4
0
0
CA
I have compiled a package, the bingo example package, it has a game, player, and shared as its parts. in its codebase i have placed an html file to lanch the player from. the player does launch with the java bingo.player.Player command, but I wish to launch it with my web browser useing the applet tag. I discovered the need to edit my policy files, to allow the client to read a file stored in my user.home directory, and have also adjusted the policy to allow similar reflection to the java.home directory. (was haveing access denied user.home read problem)
I have also set my browser to run all both signed and unsigned applets so that I know that it is not restricting my applet from running.
I launch my server and have my code in a bingo directory in the root of my serveraddress.
inside that bingo directory is the bingo dir containing the packages, and the htm code to accsess the bingo.player.Player applet.
the applet does not launch, and the console gives the following responce:
java.lang.ClassCastException
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 am not sure but I am currenty thinking that it is generated by the fact that the player class is trying to access the shared classes and that the policy file is still needing more tweaking.
the code runs fine with cammand line java command, but not in appletviewer or browser.
would really be thankfull for some advice ?:)
 
>java.lang.ClassCastException
this usually means you're trying to cast a class that does not belong in the class hierarchy.


I got this error once when working with Jakarta Struts. The best way to trap this exception from being thrown is to check the class hierarchy using instanceOf keyword. But then you need to overwrite the equals() and hachcode() methods.

~za~
You can't bring back a dead thread!
 
I am impressed, but I have to ask, why can i run the code without err, and with non erratic results, from the java command, and yet through the browser, it has a castclassexception, I mean should not the same classes be availiable to it in or out of the browser?
what is the cause of that kind of a mixup, (seeing as it works fine from the command line, I have to assume the browser messes it up.
ps, I have this thread also at sun's forum, but I am thinking that not a lot of ppl that have it all down pat read these forums, and it seems that this (probibly so common that they could have it in a faq) problem is stummped them.
 
i don't really know that answer but in struts, I cannot return a null to a form. I will get nullpointerexception even though in java world, it will work fine. Somehow jasper doesn't like you return a null to a form.

sounds like "double std" to you?

~za~
You can't bring back a dead thread!
 
This is probably too late for you, but it sounds as if you have written an application, not an applet.

While an application works by call a static void main method, an applet must extend java.applet.
The browser will then call the class's start() method when the applet is to start.

You can write a class that will run as both an application and an applet, but you will need it to extend java.applet and contain a public static void main( String[] args ) method that calls the start() method.

 
johnburgess, Thank you, though In the effort to learn new things, it is never too late, yes, I am sure this is not an applet, but an application.
Thanks all for the feedback, in the old days there was never this kind of help unless you had a modem and a good bbs to call long distance, I hope I can make your efforts not to be wasted on me. 8)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top