Case Sensitivity

Question:
Is Java platform-dependent where the case sensitivity of filenames is concerned? In Unix, filenames are case sensitive whereas in Windows they are not. How does it work when Java is reading filenames from a directory structure?

Answer:
Java relies on the underlying platform for opening files. Therefore, the case sensitivity of filenames will be determined by the native file system. You should keep this in mind when naming files that are used by your Java applications. No two files should have the same name based on a caseless comparison. Otherwise, when you distribute your application, one file may overwrite the other on case insensitive file systems.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: