Page 2 of 2 FirstFirst 12
Results 21 to 37 of 37
  1. #21
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    The applet runs fine the times when it loads, just with 2 images missing. Surely the times when it does not load at all cannot be attributed to the java code itself?

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

    Default Re: Java Applet Strange Image Loading Problem

    I can not say what the code in the applet is doing. That's something you will have to track down. One way is by adding printlns to show what the code is doing.

  3. #23
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    I'm certain there is nothing wrong with the applet itself, it runs fine using appletviewer and on most other computers on my local network and on the internet. The problem seems to be in downloading the files.

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

    Default Re: Java Applet Strange Image Loading Problem

    certain there is nothing wrong with the applet
    How does the applet read/load the image files? Does it treat them as resources or ???
    The problem seems to be in downloading the files.
    Then you must be sure to put the files in the correct location on the server.

  5. #25
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    The images are loaded like this:

    image = getImage(getDocumentBase(),"image.gif");

    All the images are in the build folder so I can't see why some would load and others not.

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

    Default Re: Java Applet Strange Image Loading Problem

    Can you put all the files in a jar file? That would simplify your problem to be one file that either is read or not.

  7. #27
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    I tried using the jar file that is created by netbeans using the archive attribute in the html file but I couldn't get it to work on any computer in that way. The jar file downloaded successfully but then it wouldn't run so I stopped trying because it seemed to be complicating things. does it matter where the jar file is? Does it have to have the jnlp file in the same folder?

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

    Default Re: Java Applet Strange Image Loading Problem

    Did you look at the HTTP status codes in the log file? for example:
    .... /main.class HTTP/1.1" 401 401
    401 is an error condition

    200 is the normal status code

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

    Default Re: Java Applet Strange Image Loading Problem

    Sorry, I do not know how to use your IDE. I use the jar command to create jar files.

    I have not used a jnlp file.

  10. #30
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    Yes, the code is 401 - unauthorized access. There is a password on the server and for some reason it doesn't seem to request some of the files with the username. As you can see from this snippet, the images it fails to load are not requested with the username "Rob".

    192.168.1.10 - - [03/Jan/2012:14:17:36 +0100] "GET /game/build/boardBase12.gif HTTP/1.1" 401 401
    192.168.1.10 - - [03/Jan/2012:14:17:36 +0100] "GET /game/build/LOGOmini.gif HTTP/1.1" 401 401
    192.168.1.10 - Rob [03/Jan/2012:14:17:36 +0100] "GET /game/build/padmainnew.gif HTTP/1.1" 304 -
    192.168.1.10 - Rob [03/Jan/2012:14:17:36 +0100] "GET /game/build/boardBase12.gif HTTP/1.1" 304 -

  11. #31
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    I just tried to run it with the password off and a similar thing happens, but no request is sent for the images which don't load.

    The most intriguing thing for me is the 5 minute gap between the first request for the main.class and the second one. Sometimes it crashes after the five minutes and sometimes it loads. I would have thought perhaps 5 minutes is the timeout but it seems to be there even though the file is successfully downloaded:

    192.168.1.10 - - [03/Jan/2012:18:09:24 +0100] "GET /game/build/classes/game/main.class HTTP/1.1" 200 110009
    192.168.1.10 - - [03/Jan/2012:18:09:24 +0100] "GET /game/build/classes/game/main.class HTTP/1.1" 200 110009
    192.168.1.10 - - [03/Jan/2012:18:14:24 +0100] "GET /game/build/classes/game/main.class HTTP/1.1" 200 110009
    192.168.1.10 - - [03/Jan/2012:18:14:24 +0100] "GET /game/build/classes/game/main.class HTTP/1.1" 200 110009

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

    Default Re: Java Applet Strange Image Loading Problem

    Sometimes it crashes
    What error messages do you get when it crashes?

  13. #33
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    Annoyingly it will only load with missing images at the moment. I will provide a more accurate description next time it happens but basically the java logo appears and spins for 5 minutes. Then there is a red error message in the corner of the white rectangle where the applet is. It says something along the lines of "error, click for more details", then a message box comes up which says something like "failed to load" and there is a "details" button. When I press the details button, the java console opens but there is nothing in it (and I have a println on the first line".

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

    Default Re: Java Applet Strange Image Loading Problem

    Is there something wrong with your java installation or browser?
    Have you tried testing it locally by putting the html file and jar file in a local folder and loading the html page from there?

  15. #35
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    I couldn't see anything wrong with the browser and I tried loading it locally with a Jar file but couldn't get it to work, I think that is another issue though because there were lots of other errors and I started to get knee deep in other issues.

    The only thing I can see with Java is that it did have Java 6 and Java 7 installed. I unistalled java 6 but the folders are still there and I noticed that it seems to be using the java 6 cache folder still. I thought that was a bit odd, but I don't know if it is a problem or not.

    However, I have made some progress. I discovered that in the Java Control Panel - Advanced tab, under Debugging, "Enable tracing" and "Enable logging" were unchecked on the computer with the errors. I checked them, and low and behold the applet loads, albeit with some images missing, but it works and the 5 minute delay (which I am fairly sure is the apache server timeout) is gone. After further investigation I found that it doesn't matter if I check Enable tracing or Enable logging, either of them makes the error disappear. But if I uncheck both of them the error comes back. I have no idea why this should have any effect! Also on the computer where the applet loads with no errors, if I uncheck both of them, the applet still loads!

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

    Default Re: Java Applet Strange Image Loading Problem

    Good work. Interesting.
    I have no idea about what is happening.

  17. #37
    robs is offline Member
    Join Date
    Feb 2011
    Posts
    58
    Rep Power
    0

    Default Re: Java Applet Strange Image Loading Problem

    OK, thank you very much for your input and time, it's always good to have someone push you in another direction! I really appreciate the help.

    Can anyone else help??

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Problem loading an Image
    By onesixtyfourth in forum Java 2D
    Replies: 1
    Last Post: 10-17-2010, 11:32 AM
  2. Problem with loading image
    By m00nchile in forum New To Java
    Replies: 5
    Last Post: 05-25-2010, 01:34 PM
  3. Problem in loading Image
    By rahulm87 in forum Java 2D
    Replies: 1
    Last Post: 09-08-2009, 04:45 PM
  4. Loading image in applet
    By syarizma in forum Advanced Java
    Replies: 0
    Last Post: 08-06-2009, 09:02 AM
  5. loading image into applet
    By balaram in forum Java Applets
    Replies: 1
    Last Post: 11-06-2008, 02:13 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
  •