0

I was compiling a .java file through the command line with the typical javac command. The file name was Test1.java, however, when I tried compiling test1.java there was no error. Why is this so?

2
  • Are you sure you don't have a test1.java on the same directory? Commented Jan 22, 2017 at 12:58
  • Tell us exactly what you did. You know this might also have to do with the file system your OS is providing. Macs for example have some strange settings around casiness of file names Commented Jan 22, 2017 at 13:00

5 Answers 5

5

Because your operating system is case-insensitive.

See also answers to: Why is the Java complier (javac) case-insensitive when java (the interpreter) is case-sensitive?

Sign up to request clarification or add additional context in comments.

1 Comment

That helped. Thank you!
1

Windows filesystem is case-insensitive. that's why you are not getting error. On *nix if you use javac with case-sensitive then you will get error

Comments

1

This is because the Java language is case sensitive but the command line is not. Test.java is not the same as test.java in java but it's the same thing in the command line.

Comments

0

May be you have test1.java and Test1.java both classes in the same folder so it was compiling for both

Comments

0

if you use platform that is case-insenstive such as: Windows that will work. But if you are in platform that is case-senstive such as: UNIX-Based, please check if there is a file with lower-case in directory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.