You Are Here:

Community: Developer Discussion Boards

#1 Old JSR75-can't access text file on the local root - 2008-04-08, 23:24

Join Date: Mar 2008
Posts: 5
dimondat
Offline
Registered User
Hi,I'm using Wireless Toolkit to run the code that suppose to access and read the text file.However ,when run ,program throws an exception notifying that the file doesn't exist.I'm aware that the files should be stored in the root1 directory used by the emulator.And when i perform print out of all the subdirectories and files within the root ,the subdirectories are being discovered ,but the files are not.Does anyone know ,why is this happening????
Reply With Quote

#2 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 09:07

Join Date: Mar 2008
Posts: 76
Send a message via MSN to Aliencse
Aliencse's Avatar
Aliencse
Offline
Regular Contributor
Can you kindly post your code here? I did it and working fine. I think you did any mistake in the path.

BR
Javed
Reply With Quote

#3 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 13:44

Join Date: Feb 2008
Posts: 44
Location: Russia, Samara
Send a message via ICQ to Red Falcon Send a message via Yahoo to Red Falcon
Red Falcon's Avatar
Red Falcon
Offline
Registered User
Maybe invalid path. Please post your code
Reply With Quote

#4 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 14:31

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
Hi dimondat,

you can take a look at PDAPDemo demo shipped with Wireless Toolkit 2.x, since it contains a simple example of a File Browser accessing local files.

Cheers,
Pit
Reply With Quote

#5 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 14:43

Join Date: Mar 2008
Posts: 76
Send a message via MSN to Aliencse
Aliencse's Avatar
Aliencse
Offline
Regular Contributor
Ya you can go through PDADemo of WTK. It is done upon FileConection Api and PIM Api.
Reply With Quote

#6 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 16:31

Join Date: Mar 2008
Posts: 5
dimondat
Offline
Registered User
I actually had something very strange going on.This morning it was working fine.Instead of the DefaultColourPhone folder,where root typically resides, everytime i ran the program it was creating a temp folder ,with temp root for each particular run of the program.When i copied files into that folder, everything was going fine.the path that i use in program is
FileConnection fc = (FileConnection)Connector.open("file:///root1/headline.txt",
Connector.READ);
I'll look at PDA demo,thanks for the advice
Reply With Quote

#7 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 16:38

Join Date: Mar 2008
Posts: 5
dimondat
Offline
Registered User
yeah,here is the code that i use

public void showFile() {

StringBuffer sb =new StringBuffer(1000);

int i=0,num=0;
String str =null;
try {
FileConnection fc = (FileConnection) Connector.open("file://localhost/root1/headline.txt",
Connector.READ);
if (!fc.exists()) {
throw new IOException("File does not exists");
}

InputStream is = fc.openDataInputStream();
while((num=is.read()) != -1){
char ch=(char) num;
sb.append(ch);}
str=sb.toString();
System.out.println();
is.close();
fc.close();



} catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}

}
Reply With Quote

#8 Old Re: JSR75-can't access text file on the local root - 2008-04-09, 16:47

Join Date: Nov 2007
Posts: 2,029
Location: Rome, Italy
Send a message via MSN to jappit Send a message via Skype™ to jappit
jappit's Avatar
jappit
Offline
Forum Nokia Champion
Dimondat, just a question: do you see any file named "in.use" in your DefaultColorPhone folder?

Sometimes it happens that it is not correctly deleted after an emulator sessions, and so following uses of emulator are not able to use files and folders: this could be the reason why it creates a new temp root folder and it does not find your file in the standard root.

At least, this happened to me sometimes :)

Cheers,
Pit
Reply With Quote

#9 Old Re: JSR75-can't access text file on the local root - 2008-04-14, 07:31

Join Date: Feb 2008
Posts: 44
Location: Russia, Samara
Send a message via ICQ to Red Falcon Send a message via Yahoo to Red Falcon
Red Falcon's Avatar
Red Falcon
Offline
Registered User
"file://localhost/root1/headline.txt" looks strange. Try just "file:///root1/headline.txt". Be shure what you have "root1" folder.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
problem when importing from carbide c++ to vs 2003! misfit.physics Symbian Tools & SDKs 12 2008-02-19 10:45
Nokia 6101 Locked 2 TMobile Midlet can't access internet... Jason Glass Mobile Java Networking & Messaging & Security 45 2007-11-14 03:19
Error with makesis.exe and creating the .pkg file gramya87 Symbian Tools & SDKs 7 2007-10-10 14:53
求助关于SDK平台变化后系统头文件出错的问题 cxg1103 Symbian 3 2007-03-07 04:36
How to append text in a text file in j2me lovely_334801 Mobile Java Networking & Messaging & Security 2 2006-01-15 07:10

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia