Case sensitive files in IntelliJ Idea on Mac OSX
Asked Answered
E

3

9

My java project has files which have same name but different cases (Test.java & test.java). I have setup a case sensitive file system on my mac and am able to view/edit them via CLI. However, Intellij Idea does not regard them as different and compilation fails. How can I fix Intellij Idea to honor cases for a file name?

Thanks

External answered 20/9, 2014 at 11:21 Comment(3)
Unless you have a really really good reason to do something like that, don't! Your file names imply a class names Test, and one named test, which goes against naming conventions. You will be unable to build your application on systems that don't honor case sensitive file names etc. etc.Harneen
The correct way to fix this is to follow Java naming conventions. 1) Never start a class name with a lower case letter. 2) Don't create classes whose name differs only the the case of some of the letters in the name. If you do that, you simply won't have this problem. And you also won't have perpetually deal with complaints about your code style, from coworkers, customers, and other people who have to read it.Somatoplasm
This is an enterprise level code base. The test.java is an output for Test.java, created by a custom build process. I work on RHEL platform, on which this is not an issue. Regardless of the java class naming convention, an application not honoring case sensitivity on a case-sensitive file system is not a correct behavior. There are files in the app which are non-java files and have names like 'Test' & 'test'. Idea is unable to distinguish between them as well.External
S
22

I filed a support request at JetBrains. Here is the answer:

add "idea.case.sensitive.fs=true" to bin/idea.properties file (https://intellij-support.jetbrains.com/entries/23395793 ), perform File | Invalidate Caches and restart the IDE.

It solved the issue for me.

update: 2015-02-14 / Idea 14.0.3

It is no longer sufficient to add the property to the idea.properties file. Add -Didea.case.sensitive.fs=true to "Settings | ... | Java Compiler | Additional command line parameters".

Standish answered 26/9, 2014 at 9:17 Comment(1)
i add idea.case.sensitive.fs=true to my idea.properties file and still getting this error. Can you help me solve it?Ceasefire
A
1

To update your case sensitive settings you can simply run the folowing in your shell (Path would have to be changed for InteliJ as I use php storm but should work for the jet brains products)

echo idea.case.sensitive.fs=true >> /Applications/PhpStorm.app/Contents/bin/idea.properties
Avrilavrit answered 8/6, 2016 at 22:32 Comment(2)
getting error no such file or directory. any help ?Kinematics
you should be able to find the file path through terminal slowly CD ing into each directory. do you use php storm or intelij ( you may have to change the path after /Applications/${your flavour}/...Avrilavrit
V
0

It looks like the best option may be to add the idea.properties option to user profile configuration rather than global.

See the first comment here:

https://confluence.jetbrains.com/display/IDEADEV/Filesystem+Case-Sensitivity+Mismatch

Also this page mentions where the idea.properties file should go, if you don't have one already.

https://www.jetbrains.com/help/idea/file-idea-properties.html

Vanderpool answered 24/7, 2017 at 10:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.