Applet class file cant be modified

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtremebass
    New Member
    • Nov 2008
    • 38

    Applet class file cant be modified

    Hi Bytes,

    i did sample Applet program in linux environment in that place where my java is installed. when i execute the code it creates the .class file and browser shows the result when i load the page. then i have opened the same program again did some modification,ma de a compilation and run the program but changes didnt affect in the browser. is it the problem in .class regenration? or what could be the problem?. suggest me.

    code i used..

    <code>
    samp.java


    import java.applet.*;
    import java.awt.*;

    public class samp extends Applet{

    public void paint(Graphics g){
    g.drawString("W elcome in Java Applet.",400,20 );
    g.drawString(" By PrastSystems",8 0,70);
    g.drawString(" By Java",50,230);

    }
    }

    samp.html

    <HTML>
    <HEAD><title>Ap plet In Jsp</title>
    </HEAD>
    <BODY>
    <APPLET ALIGN="CENTER" CODE="samp.clas s" WIDTH="800" HEIGHT="500">
    </APPLET>
    </BODY>
    </HTML>

    </code>
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    If you are sure the old .class file was replaced then try clearing your browser's cache before running again.

    Comment

    • xtremebass
      New Member
      • Nov 2008
      • 38

      #3
      Applet Modified code cant updated/displayed in the Browser

      hi thanks for reply.

      i did what you have suggested.

      But still i am getting the old information in the browser ,updated /modified changes cant be affected.

      what cause the program to display the same data(rather than showing the updated information) when page loads in the Browser?

      Please suggest me something to tackle this problem.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by xtremebass
        hi thanks for reply.

        i did what you have suggested.

        But still i am getting the old information in the browser ,updated /modified changes cant be affected.

        what cause the program to display the same data(rather than showing the updated information) when page loads in the Browser?

        Please suggest me something to tackle this problem.
        What happens when you quit your browser and restart it again? It this works you have to flush your cache as has been suggested. If it doesn't you haven't produced a new .class file or it can't be found while the old .class file is still reachable.

        kind regards,

        Jos

        Comment

        • chaarmann
          Recognized Expert Contributor
          • Nov 2007
          • 785

          #5
          Caching

          Originally posted by xtremebass
          But still i am getting the old information in the browser ,updated /modified changes cant be affected.
          .
          It can have different reasons
          1.) Maybe you are connecting through a proxy server which caches the old class file.
          In this case, configure your browser to bypass the proxy for this hostname under LAN-settings.
          2.) Or the webserver (for example Apache) caches the class-file, because you have not configured it to immediately reload changed class files. Try to restart the webserver. If it works afterwards, that was the reason.
          3.) Or your browser caches it. Then simply restart of the browser won't work. You have to explicitly tell the browser under internet-option to clear whole cache first, and then restart. There is an option in the explorer to always check for new source and load it instead of getting it from cache. Activate it.

          You can also set the expiry time to 1 millisecond with an HTML meta tag in your webpage. Some browsers and proxys listen to that.

          Finally, if all doesn't work, just rename your class file. If you don't get an error, then it is still one of the points 1 to 3 that you didn't fix.If you get an error, then you know the cache can't be the reason.
          Then try to change the name in the html-page to the new class file name. If the changed version shows up, all is ok. But if the old version shows up, then you know it has to do something with the compilation. In this case:

          Did it really compile the new version? Maybe it's still the old class file (check date/size before and afterwards). Did you really save your changes in java file or are the changes only in editor? Does it grab the right java-file and libraries for compilation ? (check path).

          Comment

          Working...