jar problem and applet on server problem

Found an easier workaround. When loading an image do this:


img = ImageIO.read(new BufferedInputStream(getClass().getResourceAsStream("/tiles/drehung.png")));

The BufferedInputStream will read the data from the server instead of ImageIO.

[quote]java 1.4.0-beta3. and theres hides the bug-devil.

i could cry if i think about the time i have wasted last days …
[/quote]
I sympathise immensely, having just spent days banging my head against the table because of a bug in 1.4.2_03.

But don’t worry - you’ll never forget to try “java -version” again ;).

Oh, and perhaps this is a good time to say “never ever use a beta JVM unless you really mean it”. That’s one way to make sure you never accidentally end up using it as your main JVM. (Cue: SWP saying it’s fine for him :). But others have already posted several significant 1.5-beta problems on these forums…)

This particular bug was not fixed until 1.5-beta, so using 1.4.2_03 would not have helped much :frowning:

But I totaly agree with you. Using a beta jvm is usually not a good idee.

ok, after beeing in internet again i need much more help than i thought:

youre all right that i must not use java beta. so i tried your suggestions:

first the one of [bold]tom[/bold] with new BufferedInputStream:

to be absolutely sure i first wrote a TestApplet :


public class TestApplet extends Applet 
{
      
      BufferedImage img=null;
      
      public void init()
      {
            System.out.println("Start...");
            ImageIO.setUseCache(false);
      
            try
            {
                  System.out.println("ImageIO start"); 
                  img = ImageIO.read(new BufferedInputStream(getClass().getResourceAsStream("/boy.png") )); 
      
                  System.out.println("ImageIO end"); 
            }
            catch(IOException e)
            {
                  System.out.println("Fehler beim Referenzieren des Images\n"+e);
            }
            
      
      }
      
      
      public void paint(Graphics g)
      {
            
            g.drawImage(img, 0, 0,  this);
            Random rand = new Random();
            
            g.setColor(Color.red);
            g.drawString(" --> "+rand.nextInt(10000)+" <-- ", 30, 250);
            
      }

}

the random-thing isnt important.
i ran the applet and the png was displayed as i have seen it before by onyx.
so i replaced all image-loading lines in my memory with just that construction above … and i get the old error.
now the thing, that mades me becoming depressive:
if i load TestApplet (working) then Memory(not working) and TestApplet again in the same browser-instance, TestApplet throws the Zip/Png error.
and i dont know why.
please test it :
this one should work first time
[link]http://zeus.fh-brandenburg.de/~huellein/test/TestApplet.htm[/link]
this one not …
[link]http://zeus.fh-brandenburg.de/~huellein/m2/Memory.htm[/link]
now the first link also shouldnt work

now my second problem, which i described in the first post:
i tried to make a jar out of my applet. so i created a manifest-txt (with line break etc) and used the command:

 jar cmf manifest.txt Memory.jar *.class dir1 dir2 etc

the jar is created properly, the manifest is written correctly all files are included. because i couldnt run it in browser (correct archive link) i tested it with java.exe -jar. then i get the error, main method wouldnt be found.
what a surprise, its an applet.

i only created jar-applications, perhaps im doing something wrong. then if can create applet jars, i can try the thing of onyx …

im very unhappy…

TestApplet always works for me, even if I run it after Memory. Although I have seen similar behaviour before. It is possible that the bug is affected by some cache laying around that is not cleared.

it is very soothing to know that you have the same suspicion.
but now im tired and sick of this problem and the applet has to be finished.
if you have some time please look at

[link]zeus.fh-brandenburg.de/~huellein/memory/Memory.htm[/link]
and tell me if it runs properly on your configuration

in this version i avoid ImageIO methods

First of all… sorry for resurrecting this dead thread :wink:

Hadn’t any problems with ImageIO before… until yesterday. Only one of my images caused ImageIO to bomb out with “Unknown row filter type (= 5)!”. Needless to say that it worked flawlessly outside the jar… duh.

Searched… found this:

[quote]Found an easier workaround. When loading an image do this:


img = ImageIO.read(new BufferedInputStream(getClass().getResourceAsStream("/tiles/drehung.png")));

The BufferedInputStream will read the data from the server instead of ImageIO.
[/quote]
…and it worked :wink:

Thanks heaps tom :-*

uhhh … im not alone, muahahahahaaa … :o