j2me reading data files

M

mannewalis

Greetings,

I am new to Java and j2me, and have a couple of questions. I want to
write a small program to display some data that I have on a j2me
enabled device. The data could be downloaded from a URL, and/or stored
locally as a file. My question is how to open a local file on the
device? And can this be done? I am wondering if the java midlet can
only access resources within its own jar file. If it can access files
outside the jar, then what would the path be to those files?

Thanks
Justin
 
J

JScoobyCed

mannewalis said:
Greetings,

I am new to Java and j2me, and have a couple of questions. I want to
write a small program to display some data that I have on a j2me
enabled device. The data could be downloaded from a URL, and/or stored
locally as a file. My question is how to open a local file on the
device? And can this be done? I am wondering if the java midlet can
only access resources within its own jar file. If it can access files
outside the jar, then what would the path be to those files?

Thanks
Justin

Hi,

You can access to file from a URL (I never did it, because I would
have to pay for the WAP/GPRS connection): use HttpConnection then open a
stream and read from it.
You can access data from the .JAD which comes with the MIDlet (or the
MANIFEST.MF file if no .JAD): use MIDlet.getAppProperty(String).
You can access database through the rms package of MIDP. Note that you
will access only database that your MIDlet create (or other MIDlet
created with the shared flag set to true).
You can't access any file from the phone (for ex., in Symbian OS, you
can't open a file by URL: "file://C/System/file.ext"). Or at least
that's what I have understood from the JVM sandbox. That gives me idea
to try tonight :)
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top