Connect with Expertise | Find Experts, Get Answers, Share Insights

Why does my Java applet not work?

 
Join Date: May 2009
Posts: 30
#1: Sep 23 '09
I've been experimenting with this Java applet and Firefox, but after I recompile the code and refresh/reopen the page, the changes are not reflected in the browser. Why's that?

Expand|Select|Wrap|Line Numbers
  1. import java.applet.*;
  2. import java.awt.*;
  3.  
  4. public class Program extends Applet
  5. {
  6.     public void paint (Graphics g)
  7.     {
  8.         g.drawString("Hello World!", 125, 225);
  9.         //g.drawString("Good morning America.", 100, 100);
  10.         g.drawString("Hamster BBQ.", 50, 50);
  11.     }
  12. }
  13.  
When I comment or uncomment one of the lines (8 thru 10), the changes are not reflected in the browser. Why is this?
Here is the code in the HTML file I'm using.
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.   <head>
  3.     <title>Java Test Program</title>
  4.   </head>
  5.   <body>
  6.     <applet code="Program.class" height=500 width=500></applet>
  7.     <div>TEST TEXT</div>
  8.   </body>
  9. </html>
  10.  

Frinavale's Avatar
E
M
C
 
Join Date: Oct 2006
Location: The Great White North
Posts: 7,068
#2: Sep 23 '09

re: Why does my Java applet not work?


My best guess would be that you need to clear your browser cache.

:)

-Frinny
 
Join Date: May 2009
Posts: 30
#3: Sep 24 '09

re: Why does my Java applet not work?


That doesn't seem to work, I'm afraid. I followed Firefox's instructions on how to clear the cache, but it doesn't seem to make any difference. Thanks anyhow.
C
 
Join Date: Sep 2006
Posts: 12,070
#4: Sep 24 '09

re: Why does my Java applet not work?


problem: I fixed some bugs and re-built my applet's source code. When i reload the applet's web page, my fixes are not showing up.

* you may be viewing a previously cached version of the applet. Close the browser. Open the java control panel and delete temporary internet files. This will remove your applet from cache. Try viewing your applet again.
. .
 
Join Date: Oct 2009
Posts: 12
#5: Oct 4 '09

re: Why does my Java applet not work?


Your applet will obviously will not start because it strictly needs a init() method to run,init method is a method to run java applet..Visit these wonderful website if you want to learn java applet programming : [<links removed>
C
 
Join Date: Sep 2006
Posts: 12,070
#6: Oct 5 '09

re: Why does my Java applet not work?


@regan2007
Don't be silly. Read the posts in this thread. The applet is displaying. It's the changes that are not being picked up.

P.S I've removed your advertising links.
Reply

Tags
applet, java