This site requires JavaScript, please enable it in your browser!
Greenfoot back
FlyingRabidUnicornPig
FlyingRabidUnicornPig wrote ...

2013/7/21

NoClassDefFoundError caused by a GreenfootImage array?

So I have a world that has an array of GreenfootImages. However, it causes an error whenever I try to initialize a new world:
java.lang.NoClassDefFoundError: Could not initialize class ExplodingWorld
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at greenfoot.core.Simulation.newInstance(Simulation.java:578)
	at greenfoot.localdebugger.LocalDebugger$QueuedInstantiation.run(LocalDebugger.java:155)
	at greenfoot.core.Simulation.runQueuedTasks(Simulation.java:465)
	at greenfoot.core.Simulation.maybePause(Simulation.java:279)
	at greenfoot.core.Simulation.runContent(Simulation.java:210)
	at greenfoot.core.Simulation.run(Simulation.java:203)
I don't know why it's doing this, but I do know it's from the GreenfootImage array. When I get rid of it, the error doesn't appear. I have double checked to make sure all the images are in my image folder (however it would've given me a different error). Here is my world class so far:
public static final GreenfootImage[] images = {
            new GreenfootImage("apple1.png"),
            new GreenfootImage("ball.png"),
            new GreenfootImage("bomb.png"),
            new GreenfootImage("brick.jpg"),
            new GreenfootImage("castle.png"),
            new GreenfootImage("castle.png"),
            new GreenfootImage("ccherries.png"),
            new GreenfootImage("lemon.png"),
            new GreenfootImage("pumpkin.png"),
            new GreenfootImage("robot.png"),
            new GreenfootImage("rock.png"),
            new GreenfootImage("smiley3.png"),
            new GreenfootImage("snowman.png"),
            new GreenfootImage("teddybear.png")
        };

public myWorld()
{
    super(600,400,1);
}
Thanks for any help!
Turns out i did have an image problem, for some reason it gave a different error than normally... Line 08, spelled "cherries" like "ccherries" fixed it and problem solved.
You need to login to post a reply.