How to display line numbers in Eclipse

By default, Eclipse’s editor will not display line numbers, it’s no good for debugging. Here’s a tip to show you how to turn on the “display line numbers” feature in Eclipse.

In Eclipse IDE, select “Windows” > “Preference” > “General” > “Editors” > “Text Editors” , check on the “Show line numbers” option.

line numbers in Eclipse

See result.

line number in eclipse editor

37 comments on “How to display line numbers in Eclipse

  1. why IDEs dont do this by default I’ll never know . _.

    Reply
  2. thanks, it was clear and simple

    Reply
  3. Thank you, it would be hard to find it without your help.

    Reply
  4. I want to thank you for the clear and easy steps. It took me about a minute or so following your directions.
    THANKS for your service!!!!

    Reply
  5. Hi Sir,
    Your post solved my problem.Thank You.
    ~Chaitanya

    Reply
  6. You, sir, have helped me in my journeys to code a minecraft client. 😉 love you man

    Reply
  7. Very helpful – I’m surprised that eclipse doesn’t display line-numbers by default, essential for de-bug especially as line-numbers are reported in LogCat. Thanks again, Neil

    Reply
    1. Is there any other websites for C++ similar to this?

      Reply
  8. In Mac OS , you have to go Eclipse > Preferences > General > Editors > Text Editors or use short command “CMD+,” and than follow General > Editors > Text Editors

    Reply
  9. Another way to do this is:
    In a File, Right click on Left Gray Bar and choose Show Line Numbers.

    Reply
  10. in this file

    [workspace].metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.ui.editors.prefs

    make sure the parameter

    lineNumberColor=0,0,0

    is NOT 255,255, 255, which is white

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *