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.

3
  • 3
    Do you have read permission for the file? Commented Feb 24, 2015 at 3: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. Commented Feb 24, 2015 at 5:05
  • 1
    my guess is, that you are leaving something out here. the error shows \... - i doubt any unix would change to a backslash. Commented Feb 24, 2015 at 8:04

1 Answer 1

0

There was a directory level privilege problem.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.