J2ME MIDP 1.0 reading files outside jar /res ?

J

jason

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.
 
D

David N. Welton

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");

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.

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.

--
David N. Welton
- http://www.dedasys.com/davidw/

Linux, Open Source Consulting
- http://www.dedasys.com/
 
D

Darryl L. Pierce

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");

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.
 
M

Mark Thornton

Darryl said:
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.

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
 
D

Darryl L. Pierce

Mark said:
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.

Interesting. I hadn't noticed which ones had this included. Can you give
me a list of which ones you've seen?
 
M

Mark Thornton

Darryl said:
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
 
D

Darryl L. Pierce

Mark said:
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.

Nice. Thanks. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top