Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

jvm

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?

like image 955
User27854 Avatar asked Jun 16 '26 22:06

User27854


1 Answers

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.

like image 115
SLaks Avatar answered Jun 19 '26 12:06

SLaks



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!