tags:

views:

22

answers:

1

This question is about J2ME: do resources packed into JAR file consume memory when not used? I need a small application, not too much code, but quite a lot of data packed with the application. This data is a large set of relatively small binary objects that will only need to be in memory one at a time. If I pack say 1MB of data files in the JAR file, does it mean I need 1MB free memory on the phone to run the application? Or do I only need enough memory to load classes from the package for the application to start?

+1  A: 

All jars are loaded into memory so to answer your question yes, it will take 1MB plus space in phone's memory. I would recommend downloading parts of this data file from server as needed, and saving it to file system or loading in memory and then deleting the objects or files when done with it.

Nowadays there are a lot of smartphones coming out with J2ME support that can allow a 1MB+ jar file, but I wouldnt bank that. And all feature phones have issues with this big jars and dont support it.

omermuhammed
I thought so... I can't force user to download objects each time it is needed since I need lots of them, one at time but usage time is relatively short. 1MB was also only an example, I will probably need much more, so packaging into JAR is not an option in this case. I'll have to use external storage. As I see JSR 75 provides API to do it, but this is restricted API, and this whole MIDLET signing concept sucks so much...
Jarek
midlet signing once understood is very easy. You should be able to sign it easily, the requirement for signing, now thats a different matter :)
omermuhammed