×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    5

    JSR75-can't access text file on the local root

    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????

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    76

    Re: JSR75-can't access text file on the local root

    Can you kindly post your code here? I did it and working fine. I think you did any mistake in the path.

    BR
    Javed

  3. #3
    Registered User
    Join Date
    Feb 2008
    Location
    Russia, Samara
    Posts
    47

    Re: JSR75-can't access text file on the local root

    Maybe invalid path. Please post your code

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: JSR75-can't access text file on the local root

    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

  5. #5
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    76

    Re: JSR75-can't access text file on the local root

    Ya you can go through PDADemo of WTK. It is done upon FileConection Api and PIM Api.

  6. #6
    Registered User
    Join Date
    Mar 2008
    Posts
    5

    Re: JSR75-can't access text file on the local root

    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

  7. #7
    Registered User
    Join Date
    Mar 2008
    Posts
    5

    Re: JSR75-can't access text file on the local root

    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());
    }
    }

    }

  8. #8
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: JSR75-can't access text file on the local root

    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

  9. #9
    Registered User
    Join Date
    Feb 2008
    Location
    Russia, Samara
    Posts
    47

    Re: JSR75-can't access text file on the local root

    "file://localhost/root1/headline.txt" looks strange. Try just "file:///root1/headline.txt". Be shure what you have "root1" folder.

Similar Threads

  1. How to append text in a text file in j2me
    By lovely_334801 in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2010-04-26, 11:10
  2. problem when importing from carbide c++ to vs 2003!
    By misfit.physics in forum Symbian Tools & SDKs
    Replies: 12
    Last Post: 2008-02-19, 09:45
  3. Nokia 6101 Locked 2 TMobile Midlet can't access internet...
    By Jason Glass in forum Mobile Java Networking & Messaging & Security
    Replies: 45
    Last Post: 2007-11-14, 02:19
  4. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53

Posting Permissions

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