javajvm

Why is the Java compiler (javac) case-insensitive when java (the interpreter) is case-sensitive?


When I was executing a Java program I noticed that the Java compiler is case-insensitive with respect to file names whereas the Java interpreter is case-sensitive.

The Java interpreter being case-sensitive is very much understandable as, the name of the class file is the name of the class defined in the Java code.

Is there any good reason for the Java compiler being case-insensitive?


Solution

  • The Windows filesystem is case-insensitive.
    You cannot (sanely) find a case-sensitive file on a case-insensitive filesystem.

    If you run javac on Linux with a case-sensitive filesystem, it will be case-sensitive.