Results 1 to 15 of 15
  1. #1
    Join Date
    Nov 2008
    Posts
    15
    Rep Power
    0

    Default NetBeans, html won't update

    right this is a newbie question. I have installed netbeans and created a java application with a single applet file for hello world. First time when I build it it and run the app an html file is created that displays it. However if I make any changes and rebuild/recompile everything it just won't update. When I rightclick myApplet.java in netbeans and select run the changes are displayed- I have tried building the project, compiling the package and compiling the actual file in the netbeans project viewer thingy but nothing.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default

    it just won't update.
    What is the "it"? The HTML might not need any changes if the class name stays the same.

  3. #3
    Join Date
    Nov 2008
    Posts
    15
    Rep Power
    0

    Default

    that's just it- I do not edit the html file. The applet inside the html does not update after the first compilation.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default

    applet inside the html does not update
    Is it a browser caching problem?
    How does the <APPLET tag in the HTML access the class file? Does it use a jar file or just a class file?

    What happens if you move the HTML and the jar file to a different folder and open the HTML in a browser?

  5. #5
    Join Date
    Nov 2008
    Posts
    15
    Rep Power
    0

    Default

    hmm tried opening in both firefox and IE with the same results.
    while a jar file is created the code in the generated html file seems to only access th class:
    <APPLET codebase="classes" code="NewApplet.class" width=350 height=200></APPLET>

    My "first" compilation was of a blank java project with nothing in it- when I move the file to another folder even if I put the jar and class files together with it I get a square with an X indicating it couldn't find em or something like that.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Is that everything working fine on Applet Viewer once you select run on that menu on the class file?

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default

    I get a square with an X
    When you open the HTML file in a browser, there should be a java console for the java vm output messages. Copy the contents of that console here.
    If you have a jar file containing the java class files, change the <APPLET tag in the HTML to include the archive=<jarfilename> attribute and remove the codebase= attribute.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    When you open the HTML file in a browser, there should be a java console for the java vm output messages. Copy the contents of that console here.
    You should enable that from the control panel. By default it's disable.

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default

    Depends on your browser.
    On Mozilla, Java console is under Tools|Web Development
    On FireFox Java console under Tools

  10. #10
    Join Date
    Nov 2008
    Posts
    15
    Rep Power
    0

    Default

    ok I have managed to get the console but it doesn't help much. After my initial success it won't update again.

    1.I create java project
    2.add a file of type "java applet"
    3.modify my code so it looks like so:

    */
    import java.applet.Applet;
    import java.awt.Graphics;

    public class NewApplet extends java.applet.Applet {

    /** Initialization method that will be called after the applet is loaded
    * into the browser.
    */
    public void init() {
    // TODO start asynchronous download of heavy resources


    }

    public void paint(Graphics g) {
    g.drawString("Hello world!", 50, 25);
    }
    3.then I compile it and in

    F:\netbeans-5.0\javaAppNew\build

    an html file appears with hello world

    4. I change "Hello world!" to "hello world! 123!", compilt it and run it- inside netbeans works but when I open it through that html page it's still "hello World!"

    I have tried changing the <APPLET tag in the HTML to include the archive=<jarfilename> attribute and remove the codebase= attribute but it does not help and why would I have to do that should that not be done automatically??

    java is so frustrating and silly! I am very grateful for your patience with me please don't give up on me!

  11. #11
    Join Date
    Nov 2008
    Posts
    15
    Rep Power
    0

    Default

    yess I figured out the problem!! In firefox REFRESH= USELESS!! I have to close firefox completely and open it again then it updates. Very silly java.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,390
    Rep Power
    25

    Default

    a Browser's caching is not part of java.

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  14. #14
    Join Date
    Nov 2008
    Posts
    15
    Rep Power
    0

    Default

    ok my mistake sorry :)

  15. #15
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by yuriythebest View Post
    ok my mistake sorry :)
    Which Firefox version are you using? On 3.0.1 there is a browser crash with a memory issue. But they have fix it on 3.0.3, the latest version.

Similar Threads

  1. JPanel won't update
    By ibanez270dx in forum New To Java
    Replies: 3
    Last Post: 01-06-2009, 08:59 PM
  2. How can I include a html file in html textarea?
    By surya_dks in forum New To Java
    Replies: 2
    Last Post: 10-04-2008, 07:20 AM
  3. [SOLVED] Update an XML file
    By Eranga in forum Advanced Java
    Replies: 4
    Last Post: 07-15-2008, 02:03 PM
  4. Using sql:update tag
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-13-2008, 11:49 PM
  5. dynamic update in swt
    By sandor in forum SWT / JFace
    Replies: 0
    Last Post: 05-14-2007, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •