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

mkyong
Founder of Mkyong.com and HostingCompass.com, 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.

Comments

  • madirajukrishnachaitanya

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

  • http://beaconimpex.com 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

  • http://www.spire-three.com 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

  • http://edokode.com 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?

  • http://www.glue-talk.com 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

  • http://civitaslearning.com 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

    [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