Re: Embedding files
[email protected] Tue, 5 Aug 2008 07:48:51 PDT
| Newsgroups | gmane.comp.java.sun.kvm |
|---|---|
| Message-ID | <22399932.75701217947762313.JavaMail.tomcat@sdcst12.sjc.collab.net> |
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: <someObject>.getClass().getResourceAsStream(filenameString); 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. -Shawn [Message sent by forum member 'sfitzjava' (sfitzjava)] http://forums.java.net/jive/thread.jspa?messageID=291601 =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff KVM-INTEREST". For general help, send email to [email protected] and include in the body of the message "help".