Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Mobile Tools for Java (MTJ) » cannot load files from res folder
cannot load files from res folder [message #18875] Sun, 25 February 2007 20:50 Go to next message
Eclipse UserFriend
Originally posted by: zhihui_yang73.yahoo.com

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
Re: cannot load files from res folder [message #18919 is a reply to message #18875] Wed, 28 February 2007 20:44 Go to previous messageGo to next message
Kevin Horowitz is currently offline Kevin HorowitzFriend
Messages: 36
Registered: July 2009
Member
The contents of the 'res' folder are added the the deployed jar and
available for use when testing the Java ME app. You need to use the MTJ
run in order to set the paths correctly and use the Deployed jar. If
you have not done this, the images will not be seen.

Z Yang wrote:
> 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
>
>
>
Re: cannot load files from res folder [message #18941 is a reply to message #18919] Mon, 05 March 2007 22:10 Go to previous message
Eclipse UserFriend
Originally posted by: zhihui_yang73.yahoo.com

Hello Kevin,

It did create jar file and the JAD file in the "deployed" folder. I
checked the jar file and all the content in "res" are there. I used run ->
"MTJ Application" to run the application as suggested in the MTJ help.
Whatelse do you think I might miss?

Thanks a lot!
Yang
Re: cannot load files from res folder [message #565997 is a reply to message #18875] Wed, 28 February 2007 20:44 Go to previous message
Kevin Horowitz is currently offline Kevin HorowitzFriend
Messages: 36
Registered: July 2009
Member
The contents of the 'res' folder are added the the deployed jar and
available for use when testing the Java ME app. You need to use the MTJ
run in order to set the paths correctly and use the Deployed jar. If
you have not done this, the images will not be seen.

Z Yang wrote:
> 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
>
>
>
Re: cannot load files from res folder [message #566025 is a reply to message #18919] Mon, 05 March 2007 22:10 Go to previous message
Eclipse UserFriend
Originally posted by: zhihui_yang73.yahoo.com

Hello Kevin,

It did create jar file and the JAD file in the "deployed" folder. I
checked the jar file and all the content in "res" are there. I used run ->
"MTJ Application" to run the application as suggested in the MTJ help.
Whatelse do you think I might miss?

Thanks a lot!
Yang
Previous Topic:Bad Stack Map error
Next Topic:is it possible to run midlets outside emulator?
Goto Forum:
  


Current Time: Thu Apr 25 10:16:43 GMT 2024

Powered by FUDForum. Page generated in 0.03378 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top