BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   File system error (http://www.blackberryforums.com/developer-forum/137813-file-system-error.html)

Jayaseelan 07-01-2008 05:54 AM

File system error
 
Hi all,

my code is,

FileConnection fc = (FileConnection)Connector.open("file:///filename.txt");

It throughs the Exception

net.rim.device.api.io.file.FileIOException: File system error

What to do now?

I want to read the content of the file...

irlennard 07-01-2008 06:16 AM

The file system has two "roots": store and SDCard. You need to specify one of these, depending on where your file is.

E.g.

Code:

FileConnection fc = (FileConnection)Connector.open("file:///SDCard/filename.txt");
-- Ian

jeyaprakash.c 07-01-2008 06:22 AM

AFAIK the problem is in your fileconnection path.where can u save your "filename.txt" wther phone are sd card memory ..

Jayaseelan 07-01-2008 06:23 AM

hi irlennard,

Thanks for your reply..

Now am trying this in Simulator... Not in Real Device..

So in Simulator how can i use this...

Thanks in Advance..

jeyaprakash.c 07-01-2008 06:23 AM

it may helps you
sdcard- SDCard/BlackBerry/
phonememory-store/home/user/

Jayaseelan 07-01-2008 06:29 AM

Quote:

Originally Posted by jeyaprakash.c (Post 995404)
it may helps you
sdcard- SDCard/BlackBerry/
phonememory-store/home/user/

Hi jeyaprakash,

Am testing it in 8800 Simulator 4.2.1 version of JDE..

How to set Path for testing in Simulator?

jeyaprakash.c 07-01-2008 06:38 AM

hi
In emulator we can use both phone and sdcard memories..

For Sdcard:
FileConnection fc = (FileConnection)Connector.open("file:///SDCard/BlackBerry/filename.txt");

For Device Memory:
FileConnection fc = (FileConnection)Connector.open("file:///store/home/user/filename.txt");

Jayaseelan 07-01-2008 07:18 AM

Quote:

Originally Posted by jeyaprakash.c (Post 995416)
hi
In emulator we can use both phone and sdcard memories..

For Sdcard:
FileConnection fc = (FileConnection)Connector.open("file:///SDCard/BlackBerry/filename.txt");

For Device Memory:
FileConnection fc = (FileConnection)Connector.open("file:///store/home/user/filename.txt");

Hi,
i tried both..

Bur both are throughs

net.rim.device.api.io.file.FileIOException: File not found

Exception..

I dont know y it happens?

rkiransuraj 12-04-2008 05:08 AM

net.rim.device.api.io.file.FileIOException: File system error
 
hi,

First check, whether the file exists in the Filesystem, you can check that through browser. just paste the file path in the browser(Alt+P) check the existance of the file, or you can see from explore also.
after that u need to check your application.
String filepath = "file:///store/home/user/filename.txt";
FileConnection conn = (FileConnection) Connector.open(filePath,Connector.READ_WRITE);

I think it will work fine , Hoep so :P

Thanks
Ravi

levantiep 05-26-2009 05:32 AM

Dear All,

When i coding for reading csv & txt file, I have a problem similar with Jayaseelan. And i have done follow everyone who have reply in this topic.
At last i have not reading csv & txt file. I'm using the "Blackberry JDE 4.7.0" tool and run it on Windown xp sp2. please help me if you know !

here is my code:

String filePath = "file:///store/home/user/test.txt";
FileConnection fc = (FileConnection)Connector.open(filePath,Connector. READ_WRITE);
if(!fc.exists()) {
throw new IOException("File does not exist");
}
InputStream is = fc.openInputStream();

Thanks & Best regards,
Tiep Le

rgholami 08-17-2009 03:35 PM

BB 8100 Simulator File Not Found error
 
Dear All,
I am simulating(using JDE 4.2.0) a MIDlet application to open/write a text file on my local XP SP2 file system as:
"OutputConnection connection = (OutputConnection)
Connector.open("file:///myfile.txt;append=true", Connector.WRITE );"
After I invoke the application on the BB Simulator, it displays:
"net.rim.device.api.io.file. FileIOException: File system erro"

I appreciate your help, Reza

Kory Lovre 09-10-2009 01:20 PM

For levantiep and rgholami (and others who come along later),

In levantiep's case it is most likely that you are trying to 'read' a file which doesn't really exist. Since you are testing in the simulator I'd try first to read a file off of the SDCard since you can easily verify if the file exists in the simulator directory or not (sorry, I haven't figured out where the simulator keeps files which are on the device memory - possibly someone else can tell us this info). When the simulator starts up you need to tell it where to put the SDCard files by selecting 'Simulte' -> 'Change SD Card'. By default it is set to 'None' - you need to choose a directory and the default directory is usually the directory where you installed the simulator. In that directory the simulator will create a directory call Blackberry with all of the subdirectories needed (such as
audiobooks, documents, music, pictures etc.). Once you do this a message will pop up in the simulater saying the SD Card is inserted (note that you must do this step every time you restart the simulator). Now place your file you want to read in the folder you want to read from and refer to it as follows:

ex: file is 'simulator directory'/Blackberry/documents/test.txt

then code is
Code:

String filePath = "file:///SDCard/documents/test.txt";
FileConnection fc = (FileConnection)Connector.open(filePath,Connector. READ_WRITE);
if(!fc.exists()) {
throw new IOException("File does not exist");
}
InputStream is = fc.openInputStream();

If you still can't open the file then you have some issue I don't know about (possibly permission issues???)

As for rgholami's case:
Again, it appears that your file does not exist in the simulator environment - I have never written/read a file from the main root "file:///" and don't know if you can do this. So, I'd suggest following the suggestion I gave levantiep above first (try accessing files on the SD Card first), then try moving the file to the device memory (I don't know how you would do this manually but you could write the file out to the device memory programmatically first and then write/read it). As well, in your case if the file you are trying to write to doesn't exist you will get an exception - so you could try to create it with fc.create(); first if it didn't exist using if(!fc.exists()).

Also noticed that you are using static method open for Connector whereas you should probably use the pattern in levantiep's example above and get a FileConnection fc.


All times are GMT -5. The time now is 11:37 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.