Results 1 to 6 of 6
  1. #1
    thevoice is offline Member
    Join Date
    May 2008
    Posts
    8
    Rep Power
    0

    Default java.io.FileNotFoundException

    Hello there,
    I need to create file on linux server.
    when i try to write existing file then i got the following error.

    java.io.FileNotFoundException: /sites/myproject/reports/jrxml/Test1.txt (Permission denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.j ava:179)
    at java.io.FileOutputStream.<init>(FileOutputStream.j ava:70)
    at java.io.FileWriter.<init>(FileWriter.java:46)
    at Test.main(Test.java:12)

    Where Test1.txt is already created file on path "/sites/myproject/reports/jrxml/".

    Also "/sites/myproject/reports/jrxml/" is linked path for "/home/reports/"on server.

    Can anybody tell me what is the reason that error is occured??
    What i have to do to solve the error? what kind of permission i have to set to the file or path?

    Regards,
    TheVoice

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    No bout that issue is on the file path. Did you try with the full path. I mean from the home directory?

    Java Code:
    /home/...../sites/myproject/reports/jrxml/Test1.txt

  4. #4
    thevoice is offline Member
    Join Date
    May 2008
    Posts
    8
    Rep Power
    0

    Default java.io.FileNotFoundException

    Hello Eranga,
    Yes this is same code for which i was talking previously.
    But when try to give full path i got the "java.io.FileNotFoundException".

    For more information,i dn't have to use /home directory in my path.

    Is it possible that i can use path without /home directory?

    Also,"/sites" folder is at the same level as "/home" folder.so my path itself is starts from
    "/sites/launchcomm/reports/jrxml/".

    Can you suggest me what kind of permission i have to set for the path?

    Regards,
    TheVoice

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Ah, if the home and sites are in same level then no need to worry about it. Can you open that text file without any permission issues. Not through the Java code, just by opening each folders of the path.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    A FileNotFoundException occurs for a number of reasons, not just that the file doesn't exist. In this case
    Java Code:
    java.io.FileNotFoundException: /sites/myproject/reports/jrxml/Test1.txt (Permission denied)
    it's pretty clear. You see that "(Permission denied)" at the end? I think that is pretty clear. Whatever user that program is executing under does not have permission to read the file.

Similar Threads

  1. FileNotFoundException
    By PeonLover in forum New To Java
    Replies: 1
    Last Post: 12-26-2007, 07:15 AM

Posting Permissions

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