I want to remove all blank lines from my code by find/replace method in eclipse code editor.
I used regular expression \\n\\s*\\n
to find all blank lin
I've been having this problem (or variations of it) for years and I suspect it's caused by sharing fileservers with Mac users, specifically users of Dreamweaver (graphic artists basically). It looks like it changes the files it edits (uploads?) to mixed/weird line endings that appear to be a combination of NL+CR (hex 0a0d), double-CR (0d0d) and solidary newlines (0a).
If you opened the same file in vim it isn't double-spaced BUT the lines all end with an ^M symbol.
Anyway, none of the solutions on this page worked for me but I found something that does.
You need to perform these steps in order (Eclipse 4.2.2)
1.) File -> Convert Line Delimiters To -> MacOS 9 (CR, \r)
2.) Edit -> Find / Replace (Ctrl - F)
Find: \r$
Replace: leave blank
3.) Replace All
If you don't do it in order or you mess with the file first you'll get an error about "incompatible line delimiters" like in the question.