have a  running  Exception

when it run,it say Exception following:
java.lang.NullPointerException

at javax.microedition.lcdui.game.Sprite.(+17)
at myprojectb.MyGameWithSpriteCanvas1.createCharacter(+37)

  at myprojectb.MyGameWithSpriteCanvas1.<init>(+48)

  at myprojectb.MyGame.startApp(+15)

  at javax.microedition.midlet.MIDletProxy.startApp(+7)

  at com.sun.midp.midlet.Scheduler.schedule(+270)

  at com.sun.midp.main.Main.runLocalClass(+28)

  at com.sun.midp.main.Main.main(+116)

why?

Why? Because you have some null object when you call the Sprite constructor. Looking at the Sprite documentation, a NullPointerException is thrown from the constructor because either the image for the sprite is null, or in the case of the copy constructor the other sprite is null.

shmoove

Strart by puting a bunch of System.out.printlns in your

myprojectb.MyGameWithSpriteCanvas1.createCharacter(+37)

method. This is one of the only ways I find null variables and exceptions. I’ve found debuggers to be less than adequate, but it’s been a while since I used one with J2ME, maybe they’ve improved?

Wood