When a Java program reaches a statement you want to inspect, Eclipse on the Linux desktop can pause execution just before that statement runs. A line breakpoint gives the debugger the place to stop.
The application has to reach the statement for the breakpoint to take effect. A line inside a conditional branch is a good place to stop when the input you plan to use takes that branch.
The Debug view shows why a thread stopped and which line it reached. Opening the Debug perspective before launching also avoids the Confirm Perspective Switch prompt that Eclipse can show when a thread suspends in another perspective.
Steps to set a debugger breakpoint in Eclipse:
Start with your runnable local Java project's saved class that contains main open in Eclipse's Java editor. The screenshots show Hello.java from the hello project open in the ~/eclipse-workspace workspace. On a first launch, Eclipse may open a sponsor page in your browser. Step 1 starts once the Java editor is visible.
- Click Open Perspective at the right end of the Eclipse toolbar.

- Select Debug in the Open Perspective dialog.

- Click Open to switch to the Debug perspective.

- Double-click the empty marker ruler directly to the left of the executable line where you want Java to pause.
The example uses line 4 of
Hello.java, whereSystem.out.println(greeting);runs. A blue dot beside the line marks the breakpoint. - Click Run on the menu bar.

- Point to Debug As in the Run menu to open its submenu.

- Click Java Application in the Debug As submenu.

- Choose Window > Show View > Debug.

- Drag the divider between the Debug view and the editor to the right if the suspension message is clipped.

- Confirm that the Debug view reports the thread suspended at a breakpoint in your class on the line you chose.
For
Hello.java, the main thread showsSuspended (breakpoint at line 4 in Hello).