I just installed MTJ and have no problem to run some simple Java games
as long as no external images or sounds are needed. However, I always
got java.io.IOException and java.lang.NullPointerException when I try to
load images from the res folder. But I have no problem to run the java
games from the standalone SUN JWT emulator, or the emulator from Nokia.
Is there anything wrong with my MTJ setup?
Here is my setup:
Windows XP
Eclipse 3.2
MTJ 0.7
emf-sdo-xsd-SDK-2.2.0
Sun Java(TM) Wireless Toolkit 2.5 for CLDC
Below is the snipet of loading images located in folder "res"
..
Image img = null;
try {
img = Image.createImage("/img1.png");
} catch (IOException ex) {
System.out.println("Error: Image files could not be loaded " +
e.getMessage());
ex.printStackTrace();
}
..
When I tried to run the sample on SUN JWT emulator through MTJ, I got
the following error message (I had no problem to run the above code on
the standalone JWT emulator):
Error: Image files could not be loaded null
java.io.IOException
- javax.microedition.lcdui.Image.createImage(), bci=30
- Arena.<init>(), bci=72
- MEInvaders.startApp(), bci=17
- javax.microedition.midlet.MIDletInvoker.invokeStartApp(), bci=1
- com.symbian.midp.runtime.MIDletScheduler.startMIDlet(), bci=26
- com.symbian.midp.runtime.MIDletScheduler.run(), bci=14
Uncaught exception: java.lang.NullPointerException
- Arena.tick(), bci=4
- Arena.run(), bci=13
- java.lang.Thread.run(), bci=11
Any help or suggestion would be greatly appreciated.
Thanks a lot,
Yang