Although it is seems simple but I’ve seen people struggle with this. Therefore, I decided to put a real quick post on how to show line numbers in Eclipse editor. There are two ways to enable line numbers in Eclipse.
First method
Open Eclipse and in the menu bar, go to Window -> Preferences and in the pop-up window, go to
General -> Editors -> Text Editors. Click on the option, Show line numbers and click on the Apply and Close button.
Second method
This is an easy way to enable line numbers. Actually it is shortcut way to do the above steps. Open any Java source file in any project and right click on the left bar in the code window. In the pop-up window which opens up, click on the option, Show Line Numbers.
How to show line numbers in Eclipse
That’s great news! You’re welcome.
Gotcha! It wasn’t a workspace problem, but a preference to don’t save configs:
Eclipse > Preferences > Oomph > Setup Tasks > Preference Recorder and turn it off.
Thank you so much!
It could be your workspace specific problem. Try creating a new test workspace and check if the line numbers work there. Also refer to this Stackoverflow solution which is similar to your problem https://stackoverflow.com/questions/51419020/eclipse-loses-my-show-line-numbers-preference-setting
Yes, I did.
I’m not sure what could cause the line number to disappear each time Eclipse is launched. Did you save the changes by clicking on ‘Apply and Close’?
Every time that I lunch Eclipse the line numbers are disabled. How can I fix it?