Hello.
I'm coding a simple cell phone application that reads a resource file
as follows:
InputStream is = getClass().getResourceAsStream("help.txt");
I was told,J2ME can read files outside the jar by specifying / before
the file name as follows:
InputStream is = getClass().getResourceAsStream("/help.txt");
Question is, how would I load that text file ouside the jad install of
the jar into most MIDP 1.0 phones? And if possible, where would see
this file from the phones menu in case I wanted to remove it at some
future date, right not my motorola a630 has an App delete feature that
would remove any resource files that came with the jar.
Just in case, I'm building a custom api that would allow clients to
update the jar with their personal data files, but it would be great if
the data and the ap install / load were completely seperate.
Thanks in Advance.
David N. Welton - 27 Dec 2005 20:33 GMT
> I was told,J2ME can read files outside the jar by specifying / before
> the file name as follows:
I don't think you're supposed to be able to do that, so it's probably
not something you can count on.
> InputStream is = getClass().getResourceAsStream("/help.txt");
>
[quoted text clipped - 7 lines]
> update the jar with their personal data files, but it would be great if
> the data and the ap install / load were completely seperate.
If you're interested, Hecl (www.hecl.org) is now at a point where it can
read and write RecordStore resources, so you could create a minimal .jar
file, and put code and data in RecordStores. Using the http extension,
you can even download it off the web, so you could dynamically update
your app.

Signature
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/
Darryl L. Pierce - 31 Dec 2005 14:48 GMT
> I'm coding a simple cell phone application that reads a resource file
> as follows:
[quoted text clipped - 5 lines]
>
> InputStream is = getClass().getResourceAsStream("/help.txt");
You were told wrong. The MIDP does not allow for accessing files outside
of the JAR and those record stores created by the MIDlet itself. There
are the optional file access APIs but those aren't implemented into any
handset of which I'm aware.

Signature
Darryl L. Pierce <mcpierce@gmail.com>
Visit my homepage: <http://mcpierce.multiply.com>
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
Mark Thornton - 31 Dec 2005 15:33 GMT
>> I'm coding a simple cell phone application that reads a resource file
>> as follows:
[quoted text clipped - 10 lines]
> are the optional file access APIs but those aren't implemented into any
> handset of which I'm aware.
JSR 75 (File Connection) seems to be implemented by quite a few
handsets. In the case of Motorola their documentations suggests that at
least 15 different handsets support it. Note that only appropriately
signed midlets can use this API.
Mark Thornton
Darryl L. Pierce - 31 Dec 2005 17:20 GMT
>> You were told wrong. The MIDP does not allow for accessing files
>> outside of the JAR and those record stores created by the MIDlet
[quoted text clipped - 5 lines]
> least 15 different handsets support it. Note that only appropriately
> signed midlets can use this API.
Interesting. I hadn't noticed which ones had this included. Can you give
me a list of which ones you've seen?

Signature
Darryl L. Pierce <mcpierce@gmail.com>
Visit my homepage: <http://mcpierce.multiply.com>
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
Mark Thornton - 31 Dec 2005 21:56 GMT
>>> You were told wrong. The MIDP does not allow for accessing files
>>> outside of the JAR and those record stores created by the MIDlet
[quoted text clipped - 8 lines]
> Interesting. I hadn't noticed which ones had this included. Can you give
> me a list of which ones you've seen?
If you go to www.motocoder.com, join, and download the sdk the list is
in the documentation. The list includes PEBL, RAZR V3i, RAZR V3g, ROKR
E1, SLVR, V190, V230/V235, V270/V280, V360/V361, V540/V557/V557p. All of
these also support JSR 75 PIM and JSR 82 Bluetooth.
Mark Thornton
Darryl L. Pierce - 01 Jan 2006 14:57 GMT
>> Interesting. I hadn't noticed which ones had this included. Can you
>> give me a list of which ones you've seen?
[quoted text clipped - 3 lines]
> E1, SLVR, V190, V230/V235, V270/V280, V360/V361, V540/V557/V557p. All of
> these also support JSR 75 PIM and JSR 82 Bluetooth.
Nice. Thanks. :)

Signature
Darryl L. Pierce <mcpierce@gmail.com>
Visit my homepage: <http://mcpierce.multiply.com>
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard