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
Tags :

About the Author

Founder of and, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.


  • madirajukrishnachaitanya

    Hi Sir,
    Your post solved my problem.Thank You.

  • Sabir

    Thanks it solves my problem easily!!!

  • etherock

    You, sir, have helped me in my journeys to code a minecraft client. ;) love you man

  • rjay

    thanks men

  • Neil

    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

  • edo

    Thanks. Really help

  • Freddy

    Thank you!! :)

  • daryl fong

    Perfect! Thanks.

  • Krishnamurthy

    This website is Excellent. Thanks a lot…!

    • Krishnamurthy

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

  • Gabriele

    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

  • http://[email protected] Muhammed Rfaat

    you are awesome :)

  • Zia

    Thanks for the lot of helpful postings

  • Robert Yerex

    Thanks for the tip on line numbers!

    • George C

      Thanks for the tip,you always have the answer!!

  • Sri

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

    • Jesper

      Thank you, Sri, this was what I needed!

  • Antonio Leite

    in this file


    make sure the parameter


    is NOT 255,255, 255, which is white