0

Question/Answer Read a file in groovy into a string is simple, except I get a FileNotFound exception no matter where I move the file, e.g. even to the root directory on a linux box.

If I do:

  String cpni = new File('/cpni_p').text

and the file cpni_p resides right in the root directory of the system (i.e. make it as simple as possible), I get a

 FileNotFoundException: \cpni_p (the system cannot find the file specified)

How do I fix this? I'm open to direct Java too -- just want to get it to work.

Community
  • 1
  • 1
Ray
  • 5,885
  • 16
  • 61
  • 97
  • 3
    Do you have read permission for the file? – Burt Beckwith Feb 24 '15 at 03:13
  • Yes, -rw-r--r-- are the permissions, for owner, group, world. I can get it to work on DOS fine with no errors -- just one line -- but doesn't work on Linux for ? reason. – Ray Feb 24 '15 at 05:05
  • 1
    my guess is, that you are leaving something out here. the error shows `\...` - i doubt any unix would change to a backslash. – cfrick Feb 24 '15 at 08:04

1 Answers1

0

There was a directory level privilege problem.

Ray
  • 5,885
  • 16
  • 61
  • 97