Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 2
    File.getCanonicalPath() is, at least with my setup, not a reliable way to get the real filename. I wrote a small class which repeatedly prints the result of File.getCanonicalPath() to the Eclipse console. While the program runs, renaming the file "abc.txt" to "Abc.txt" results in getCanonicalPath() still returning "abc.txt", until I restart the program / JVM. My setup is JDK 6u45 and Windows 10. I had to use a solution based on the expression ArrayUtils.contains( parentFile.list(), realFileName ). Commented Feb 28, 2018 at 21:11
  • This does not work in a UnitTest on my Linux Mint, my suggestion is to test it on your targeted system and have another / a better fallback version. Commented Sep 20, 2018 at 15:11