×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Mar 2009
    Location
    Delhi
    Posts
    223

    Thumbs up throwing exception 'file is not found'

    in j2me app
    my csv file is in com.school.student package
    and the file where i write my code is in the same package 'student'
    and the code is:

    InputStream is = getClass().getResourceAsStream("CWGData.csv");
    StringBuffer sb = new StringBuffer();
    try{
    int chars, i = 0;
    while ((chars = is.read()) != -1){
    sb.append((char) chars);
    }
    System.out.println(" ---------- CSV file is: ---- " + sb.toString());
    return sb.toString();
    }catch (Exception e){}
    return null;



    and it is throwing exception of file not found..
    i dont understand what's the problem ??
    Thanx
    Pooja

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: throwing exception 'file is not found'

    Is that csv file is inside the resource folder?
    or where is the file?

    What the exact exception you are getting, is this IOException ?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Regular Contributor
    Join Date
    Mar 2009
    Location
    Delhi
    Posts
    223

    Re: throwing exception 'file is not found'

    i have tried it both the ways by placing it into res folder or into com.school.student package also.
    and the exception is java.lang.NullPointerException
    Thanx
    Pooja

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: throwing exception 'file is not found'

    Quote Originally Posted by poojs View Post
    i have tried it both the ways by placing it into res folder or into com.school.student package also.
    and the exception is java.lang.NullPointerException
    That means your path is not correct..
    Have you add the res folder to the project?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Mar 2009
    Location
    Delhi
    Posts
    223

    Re: throwing exception 'file is not found'

    yes i have tried it
    Thanx
    Pooja

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: throwing exception 'file is not found'

    try utStream is = getClass().getResourceAsStream("\CWGData.csv");

    put the file in res folder.

    once the jar is made, check if contains the required res file in it?

    thanks,
    ~Amitabh

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: throwing exception 'file is not found'

    Quote Originally Posted by poojs View Post
    yes i have tried it
    I guess you have not add the res folder to the project.have you?
    if yes then check the name of the file.
    Try "/" before the name of the file.

    Also you try to read the text file first and draw the text on the form though,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. How to create a sis using ensymble and Python 1.9.4 ?
    By marcelobarrosalmeida in forum Symbian
    Replies: 10
    Last Post: 2009-05-27, 10:16
  2. Problem with pyobfuscate
    By JOM in forum Symbian
    Replies: 3
    Last Post: 2008-06-20, 22:47
  3. 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
  4. Help needed with a 3gp file...
    By joedoe_1981 in forum Streaming and Video
    Replies: 0
    Last Post: 2007-07-18, 18:58

Posting Permissions

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