In this article, we will discuss how to enable/display line numbers in Eclipse IDE for any files like .java, .xml or .jsp
Q) Why it is needed?
- Whenever, any exception or errors are thrown while executing Java program, then server console prints exception/error stack-trace along with its location i.e.; line number
- To fix this, we need to search using line number
- Note: by default Eclipse IDE doesn’t comes with line numbers enabled
- So, we need to explicitly enable this using 2 options
1. Enable Line Numbers using 2 options:
- Using Menu option in Eclipse IDE
- By right-clicking mouse and enabling line numbers (CTRL + F10)
1.1 Enable using Menu option
Eclipse IDE –> Windows –> Preferences –> General –> Editors –> Text Editors –> check line number (option)
1.2 Right-click –> enable line numbers
Alternatively, we can enable by right-clicking mouse and selecting the option “show line numbers”
Instead of right-clicking, we can also use short-cut keys supported in Eclipse IDE. Like, for enabling line numbers press CTRL + F10 simultaneously and check the option “show line numbers”
2. Useful Eclipse IDE shortcuts :
- Eclipse IDE – How to show line numbers ?
- Eclipse IDE – How to GO TO any line number directly ?
- Eclipse IDE – How to remove unused imports ?
- Eclipse IDE – How to clean project ?
- Eclipse IDE – How to build Java project automatically ?
- Eclipse IDE – How to comment and un-comment line & block ?
- Eclipse IDE – How to generate constructor using fields ?
- Eclipse IDE – How to generate getters and setters ?
- Eclipse IDE – How to search files ?
- Eclipse IDE – How to locate methods in Java file ?
- Eclipse IDE – How to open editor using CTRL + E ?
- Eclipse IDE – Java compiler compliance level issue
Related Articles:
- Apache Maven – Introduction
- Apache Maven – Install on Windows 7 OS
- Apache Maven – Settings.xml explanation
- Apache Maven – Proxy setting explanation
- Apache Maven – pom.xml explanation
- Apache Maven – Plugins explanation
- Apache Maven – Changing default Maven repository location in Windows 7 OS
- Apache Maven – Local, Central and Remote Repositories
- Apache Maven – Installing custom library into local repository
- Apache Maven – Transitive dependencies explanation
- Apache Maven – Exclusion of Transitive dependencies
- Apache Maven – Dependency Scopes
- Apache Maven – Skipping unit test using surefire plugin
- Apache Maven – Exclusions and Inclusions of unit test
- Apache Maven – offline execution
- Apache Maven – Co-ordinates explained
- Eclipse + Maven – Integration
- Eclipse + Maven – How to import Maven project with pom.xml ?
- Eclipse + Maven – Setting M2_REPO classpath variable in IDE
- Eclipse + Maven – M2_REPO is Non Modifiable
- Eclipse + Maven – Creating and exploring projects using archetypes
- Eclipse + Maven – Converting Web project to Maven project
- Eclipse + Maven – mvn eclipse:eclipse command
- Eclipse + Maven – Plugin execution not covered by lifecycle configuration
References:
- https://wiki.eclipse.org/Graphical_Eclipse_FAQs#How_do_I_show_line_numbers_in_the_Eclipse_text_editor.3F
- https://www.eclipse.org/forums/index.php/t/82856/
Happy Coding !!
Happy Learning !!