Remove unwanted blank line eclipse editor
Solution 1
In eclipse preference setting you can remove all the unwanted blank lines. Eclipse: Window > Preferences > Java > Code Style > Formatter > Edit the formatter and following screen will pop up.
And when you format the code all unwanted blank lines will be removed.
Solution 2
Find: ^\s*\n
Replace with: (empty)
Solution 3
Maybe you didn't understand what Anshu said. Do a Ctr-F on your editor. In the options, select Regular Expression. Enter ^\s*\n for the Find expression. Keep the Replace box empty. Replace All!
This of course might lead to removal of unwanted lines as well.
Solution 4
Due to your eclipse setting.
you can change your setting from preferences.
Solution 5
- Find and replace as Regular Expressions with ^\s*\n
- Press Ctrl + Shift + f
- Press Ctrt + Shift + o
![Ankur Loriya](https://i.stack.imgur.com/VJXQ2.jpg?s=256&g=1)
Ankur Loriya
Updated on April 16, 2021Comments
-
Ankur Loriya about 3 years
When i open any file in eclipse. it show alternative blank line after all the code lines and blank line. how can i remove it....
-
Ankur Loriya over 11 yearsthis problem of setting but i dont know how can i resolved this issue.
-
Mohd Kalimullah Sheikh over 11 yearswhould you like send me version of eclipse IDE
-
Mohd Kalimullah Sheikh over 11 yearsin Eclipse 3.7.2 you just right click on left side of editor , according to you print screen , you just RC below yellow triangle show
-
Ankur Loriya over 11 yearsevery new opened file has this problem.
-
Kano over 11 yearsHmm, ok try this. Go to Window -> Preferences -> Java -> Code Style -> Formatter. Create a New Formatting profile. When you do that you will see a bunch of tabs. One of them will be 'Blank Lines'. Here there are a bunch of customization options. You can play with these and apply the new profile to your project.
-
Dean_Wilson over 11 yearsI get "Error Incompatible line delimiter near index 1748"
-
Deckard about 9 yearsBetter answer than using regex, but didn't work in luna
-
Marc Johnen over 3 yearsDon't forget to choose "Regular expressions" in the find and replace dialog.