I am new to J2ME programming. I finally got a program transferred to my Sony Ericsson w300i phone, installed, and running. I copied the .jar and .jad files to my "Other" folder, and installed it into the "Applications" folder. It runs.
But what I really want to do is now transfer a text data file to the phone periodically, and have the program read data from that file. I have transferred the text file to the "Other" folder, but I am not able to read from the file. I have tried:
FileConnection fc = (FileConnection)
Connector.open("file:///c:/text.txt",Connector.READ);
FileConnection fc = (FileConnection)
Connector.open("file:///c:/other//text.txt",Connector.READ);
FileConnection fc = (FileConnection)
Connector.open("file:///c:/Other//text.txt",Connector.READ);
and many other combinations. I keep getting a SecurityException. I think that I just don't know where to put the text file, or how to refer to it, but there could be some other permissions problem that I don't know about.
Unfortunately, the documentation on all of this is not good. I surely appreciate any help that anyone can provide.
Rodney Pearson
rodney.pearson@msstate.edu
3 43882
More information on my request, in case anyone can help, because I am still spending hours on this and making little progress.
I have specified the desired permissions in my .jad file:
MIDlet-Permissions:
javax.microedition.io.Connector.file.read,
javax.microedition.io.Connector.file.write
(all on one line, split here only for readability).
I still get SecurityException. I have tried FileSystemRegistry.listRoots() to get the names of my root directories, but I get a SecurityException on that also.
I installed the PDAPDemo program that comes with the Sony Ericsson software, and it also encounters a SecurityException error. Even their own demo software is not working.
So far, Sony Ericsson has provided no help. I hope that someone out there can.
I am new to J2ME programming. I finally got a program transferred to my Sony Ericsson w300i phone, installed, and running. I copied the .jar and .jad files to my "Other" folder, and installed it into the "Applications" folder. It runs.
But what I really want to do is now transfer a text data file to the phone periodically, and have the program read data from that file. I have transferred the text file to the "Other" folder, but I am not able to read from the file. I have tried:
FileConnection fc = (FileConnection)
Connector.open("file:///c:/text.txt",Connector.READ);
FileConnection fc = (FileConnection)
Connector.open("file:///c:/other//text.txt",Connector.READ);
FileConnection fc = (FileConnection)
Connector.open("file:///c:/Other//text.txt",Connector.READ);
and many other combinations. I keep getting a SecurityException. I think that I just don't know where to put the text file, or how to refer to it, but there could be some other permissions problem that I don't know about.
Unfortunately, the documentation on all of this is not good. I surely appreciate any help that anyone can provide.
Rodney Pearson
rodney.pearson@msstate.edu
Might be possible that u have not set the permissions to read or write the file
First set the permissions from Toolkit>>Settings>>Permissions
the save the file u want to read in root directory
my root directory is at C:\WTK25\appdb\DefaultColorPhone\filesystem\root1
and then try this
FileConnection fc = (FileConnection)
Connector.open("file:///root1/filename.extension",Connector.READ);
.
Might be possible that u have not set the permissions to read or write the file
First set the permissions from Toolkit>>Settings>>Permissions
the save the file u want to read in root directory
my root directory is at C:\WTK25\appdb\DefaultColorPhone\filesystem\root1
and then try this
You can try this too. It is for a file copy on the local mobile
FileConnection fc = (FileConnection)
Connector.open("file:///root1/filename.extension",Connector.READ);
.
FileConnection fci = (FileConnection)Connector.open("file:///" + oldName);
FileConnection fco = (FileConnection)Connector.open("file:///" + currDirName + newName);
fco.create();
InputStream is = fci.openInputStream();
byte b[] = new byte[1];
int length = is.read(b);
int ch;
OutputStream os = fco.openOutputStream();
for(int i=0;i<fci.fileSize();i++)
{
if((ch = is.read())!= -1)
os.write(ch);
}
os.close();
is.close();
Sign in to post your reply or Sign up for a free account.
Similar topics
by: rodchar |
last post by:
hey all,
is there a quick way to read.all the contents of a text file, search for the
text, and if it finds that text to read the entire line?
thanks,
rodchar
|
by: mart2006 |
last post by:
Hi,
I'm currently reading a text file via PHP which, in itself, is very easy. However I want to specifically get one word from the text file and assign it as a variable and I'm struggling like...
|
by: Z.K. |
last post by:
In C#, using the StreamReader, how do I detect when you get to the end
of line. I am reading a text file using the Read() function and I need
to detect the \n\r, but everything I try does not...
|
by: christine0207 |
last post by:
Hi,
how to generate a fixed length data text file using Scripting.TextStream / filesystemobject.
|
by: bambataa |
last post by:
Hellloww...i am new to Java and i am facing a problem, i am reading a text file, i am using string tokenizer class,..now at some point when i read a first token i have to check it if its an integer...
|
by: engggirl3000 |
last post by:
Another question I have, what is the difference between reading a text file to a program and opening a text file in the program?
A sample of one of the text files is formatted like this:
3
...
|
by: MiziaQ |
last post by:
How can I delete a row of data from a data/text file in vb6 ? I am using an MSFlexGrid, so the user can select which row is to be deleted.
Thanks in advance,
MiziaQ
|
by: thanawala27 |
last post by:
Hi,
I'm facign a strange problem in reading a text file.
The contents of my text file is:
A1;B1;C1;D1
A2;B2;C2;D2
A3;B3;C3;D3
|
by: friend.blah |
last post by:
i have a text file lets say in this format
abc abs ajfhg agjfh
fhs ghg jhgjs fjhg
dj djk djghd dkfdf
....
....
......
i want to read the first line at certain time for eg : at 10clk
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| | |