HELP! My applet won't run on a web browser....
This is for an assignment I need to turn in tonight! My applet runs fine in Eclipse, but when I try to open it in a web browser, the screen goes white, acts like its loading something, but then quits and stays a white screen. I've got the .class file, .java file, and .html file all in the same directory from where I attempt to launch the .html file. I made an .html doc which reads:
<applet code="<filename>.class" width="300" height="150">
</applet>
I made a different applet previously using the same .html file format above, with merely a different .class file name and it worked fine in a web browser!
If anyone has any insight to the problem, PLEASE respond....
Thanks in advance,
-C
Re: HELP! My applet won't run on a web browser....
One thing I just noticed, in the directory with all the files, there's a file named <filename>$1.class. This type of file is NOT present in the directory of the applet that DOES work in a web browser. I'm veeeeery new to programming and java, what does this type of file represent and would it be causing the problem?
Thanks,
-C
Re: HELP! My applet won't run on a web browser....
...figured it out. I was using the wrong format in my html file. I switched it to the correct form and now the applet loads.
Re: HELP! My applet won't run on a web browser....
What was the correct format? I have the same problem
Re: HELP! My applet won't run on a web browser....
Bertorox the correct way is to do the following.... I just solved mine.....
<html>
<title>UNDER CONSTRUCTION</title>
<br>
<body>
<center>
<applet code=Game.class codebase=dev/SUPINC/ name=Game
width="1024" height="768">
<param name="bgcolor" value="ffffff">
<param name="fontcolor" value="000000">
Your browser is not Java enabled.
</applet>
</center>
</body>
</html>
Now my index.html file is in the root of my webhost ..... the Game.class is @ /dev/SUPINC/ so I used (codebase=dev/SUPINC/) to navigate to that directory to tell the page that's where my Game.class file is located.....
ALSO VERY IMPORTANT!!! Make sure when you upload your items there'll be a file called (IN MY EXAMPLE) Game.class AND a file called Game$1.class
YOU MUST UPLOAD THEM BOTH!
That fixed my error :D
You can see mine in action here: UNDER CONSTRUCTION