When I pass `File file` to a method I'm trying to get its full path like `file.getAbsolutePath();` I always get the same result no matter which one I use either absolute or canonical path `PATH_TO_MY_WORKSPACE/projectName/filename` and it is not there, how can I get exact location of the file?

Thank you

**DETAILS:**

Here is some code and this solutions(its bad but its working):

```
 private static void doSomethingToDirectory(File factDir) throws IOException {
            File[] dirContents = factDir.listFiles();

            if(factDir.isDirectory() && dirContents.length > 0){
                for (int i = 0; i < dirContents.length; i++) {
                    for (String str : dirContents[i].list()) {
                        if(str.equals(TEMP_COMPARE_FILE)){
                            process(new File(dirContents[i].getAbsolutePath() + "\\" + str));
                        }
                    }
                }           
            }
        }

```

I'm looping trough directories where factDir is `src/main`, I'm seeking toBeProcessed.txt files only that is TEMP\_COMPARE\_FILE value and I'm sending them to process method which reads the file and does processing of it.

If someone could better solution I'd be greatful