Nowadays it is common to work in a multi-platform (Windows, Linux, Mac) development environment and that means different file line endings characters.
To terminate text files lines, Windows uses two characters, CR (Carriage Return) and LF (Line Feed), while Linux and Mac OS X use LF character only and “old” Mac OS uses CR only.
Three platform, three combinations. We are not lucky.
NetBeans can handle all combinations, while opening and saving text files (.java, .html, .css, .php,….) but this is not necessarily the case for all developments tools we are using.
Best approach is to use just one and, we are now lucky, one plugin can help us.
The “Change Line Endings on Save” plugin can be found here and on NetBeans plugin portal.
Once installed, we can decide to have NetBeans or project based setup. Development teams should use project based setup so every developer uses the same configuration.
NetBeans based setup can be found on Tools → Options → Editor → Line Endings as in the following image: