Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Java Development User Guide
Previous Page Home Next Page

Identifying problems in your code

In this section, you will review the different indicators for identifying problems in your code.

Build problems are displayed in the Problems view and annotated in the vertical ruler of your source code.

  1. Open junit.framework/TestCase.java in the editor from the Package Explorer view.
  2. Add a syntax error by deleting the semicolon at the end of the package declaration in the source code.

    Editor with missing semicolon

  3. Click the Save button. The project is rebuilt and the problem is indicated in several ways:
    • In the Problems view, the problems are listed,
    • In the Package Explorer view, the Type Hierarchy or the Outline view, problem ticks appear on the affected Java elements and their parent elements,
    • In the editor's vertical ruler, a problem marker is displayed near the affected line,
    • Squiggly lines appear under the word which might have caused the error, and
    • The editor tab is annotated with a problem marker.

    Problem marker in Package Explorer, editor and Tasks view

  4. You can hover over the marked word in the editor to view a description of the problem. You can also hover over the problem markers in the vertical or overview rulers.

    Problem marker hover

  5. Click the Close ("X") button on the editor's tab to close the editor.
  6. In the Problems view, select a problem in the list. Open its context menu and select Go To. The file is opened in the editor at the location of the problem.

    Problems view

  7. Correct the problem in the editor by adding the semicolon. Click the Save button. The project is rebuilt and the problem indicators disappear.
  8. In the Outline view, select the method getName(). The editor will scroll to this method.
  9. On the first line of the method change the returned variable fName to fTestName. While you type, a problem highlight underline appears on fTestName, to indicate a problem. Hovering over the highlighted problem will display a description of the problem and applicable quick fixes.
  10. On the marker bar a light bulb marker appears. The light bulb signals that correction proposals are available for this problem.

    Light bulb and problem highlight line

  11. Click to place the cursor onto the highlighted error, and choose Quick Fix from the Edit menu bar. You can also press Ctrl+1 or left click the light bulb. A selection dialog appears with possible corrections.

    Correction proposals

  12. Select 'Change to fName' to fix the problem. The problem highlight line will disappear as the correction is applied.
  13. Close the file without saving.
  14. You can configure how problems are indicated on the Goto the annotations preference page General > Editors > Text Editors > Annotations preference page.
Related concepts

Java editor
Java views
Java builder

Related reference

Editor preference page
Quick fix


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire