Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Strange error with an applet  (Read 1377 times)
0 Members and 1 Guest are viewing this topic.
Offline allan_s

Senior Newbie




pwned


« Posted 2004-12-24 13:23:41 »

I've created an applet for a school project, and unfortunately it seems like no one but me can play it.  When I run it from my computer, (which is Java 1.5), it loads and plays flawlessly.  However, whenever I ask friends to test it for me, (and they have 1.4.x), it crashes on loading.  At first I assumed it was an issue with which version I compiled it in, but after compiling it with 1.4.1 and asking them to test it again, it still crashes.  The game is located at http://www.epikgames.com/test.html if you would like to try it yourself and see if you can run it.  If you do get an error and can explain why it doesn't load, I would much appreciate it.  The reason i'm posting in this forum is that it seems that the error is ImageIO related.  Thanks in advance!

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #1 - Posted 2004-12-24 13:30:57 »

yeah, there are several issues with ImageIO in 1.4.1.

Advise your friend to upgrade his JVM to 1.4.2 or 1.5.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline allan_s

Senior Newbie




pwned


« Reply #2 - Posted 2004-12-28 04:52:16 »

Unfortunately I don't think its as simple as upgrading from 1.4.1 to 1.4.2.  Again if you could take a minute to try the page yourself, I'd appreciate it.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #3 - Posted 2004-12-28 09:04:41 »

Works with 1.5 (though whatever method you are using for Threading/repainting sux - its horribly stuttery)

Can't test it with 1.4.x, I don't have them installed.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #4 - Posted 2004-12-28 11:25:25 »

Here's your problem:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
java.util.zip.ZipException: invalid stored block lengths
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:140)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
        at java.io.FilterInputStream.read(FilterInputStream.java:66)
        at com.sun.imageio.plugins.png.PNGImageReader.decodePass(PNGImageReader.
java:1165)
        at com.sun.imageio.plugins.png.PNGImageReader.decodeImage(PNGImageReader
.java:1276)
        at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.j
ava:1362)
        at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1
530)
        at javax.imageio.ImageIO.read(ImageIO.java:1384)
        at javax.imageio.ImageIO.read(ImageIO.java:1348)
        at com.epikgames.Lander.LanderApplet.loadImage(LanderApplet.java:119)
        at com.epikgames.Lander.LanderApplet.init(LanderApplet.java:104)
        at sun.applet.AppletPanel.run(AppletPanel.java:353)


We need to see your "loadImage" code. I have a sneaky suspicion that you're doing something kind of wierd.

Also, the tag:

1  
code="com.epikgames.Lander.LanderApplet.class"


shouldn't have the ".class" on it. That should read:

1  
code="com.epikgames.Lander.LanderApplet"


Java Game Console Project
Last Journal Entry: 12/17/04
Offline tom
« Reply #5 - Posted 2004-12-28 11:41:53 »

Probably the standard ImageIO bug, wich was fixed in 1.5. You need to give ImageIO a input stream wrapped in a BufferedInputStream, like this:
1  
sourceImage = ImageIO.read(new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream("pathToFile")));

Offline allan_s

Senior Newbie




pwned


« Reply #6 - Posted 2004-12-28 19:19:48 »

Here's my loadImage() code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public BufferedImage loadImage(String file) {
            BufferedImage image;
           
            try {
                  image = ImageIO.read(LanderApplet.class.getClassLoader().getResource(file));
            } catch(IOException e) {
                  e.printStackTrace();
                  return null;
            }
           
            return image;
      }


I'll give tom's suggestion a try, that's probably what the problem is, right now.  If you get another chance, see if you can run it after I make the changes.

Quote

Works with 1.5 (though whatever method you are using for Threading/repainting sux - its horribly stuttery)

I appreciate the feedback, but I'd have to see what you're experiencing, as the applet runs relatively smoothly on my laptop, (2.6 ghz 512 ram,  64mb Radeon 7500).  I am manually double buffering which means that the applet currently is not making use of Vram, which may be the reason you're experiencing inadequate performance.  I tried to implement the standard double buffering system but for one reason or another I couldn't get it to work and I was crunched for time so I had to drop it.  I'm really not concerned with its visual performance right now as much as the accuracy of the physics, most of which still has to be implemented.  Anyways, thanks very much for everyone's help, it is much appreciated!

Offline tom
« Reply #7 - Posted 2004-12-28 20:54:59 »

It worked now with Java 1.4.? in IE.

Offline allan_s

Senior Newbie




pwned


« Reply #8 - Posted 2004-12-29 00:22:51 »

Very cool - thank you for your help!

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (45 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!