I'm developping a JME application using Eclipse and its plugin EclipseME. I would like to use one image from my own file system in my program. But I don't know how to do it. The image isn't push from my project to my emlator (I'm using sun wtk).
Since JavaME doesn't have a "filesystem" (unless you are using the PIM jsr-75) the way to get access to file in your project is via a call like this:
For images you can simply use: Image.createImage(filenameString);
You package your resource into your jarfile by making a subdirectory in your project root path called "res". Then put your images in that directory. The WTK will take the contents of your src directory and the res directory and put them into your jarfile for deployment to the device. For the emulator you do not have to package the project, the emulator uses the resource directory.
In the EclipseME plugin, I believe you have to setup the project to recognize that the "res" directory is for your resources. Else you can simply put a res directory in your src directory and that should also do the trick.
hope that helps.
It doesn't work, i've already put my images in /res but I'm unable to access them without having an IOException.
My res directory was already defined it EclipseME.
However thanks !
l made it works : do not use "_" in your filenames !
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.