Skip to content

Debug Mode in Eclipse for Java (Video)

Learn how to use debug mode in Eclipse to debug a Java program: breakpoints, step-by-step execution with F5-F8, and a video tutorial.

Ricardo Moya

Debug mode lets you run programs and watch how the instructions in your program’s source code are executed. It also lets you see the values of variables and attributes, and you can change those values to force possible errors or exceptions in your program.

In this post we are going to show how to "debug" a program written in Java with the Eclipse IDE. To do that, we will need to use what are known as "BreakPoints", which are stop points that we put in our code so we can navigate through it while it runs.

BreakPoints_Jarroba

To move through the code step by step we will use the F5, F6, F7 and F8 keys, which correspond to the following buttons in the IDE:

BreakPoints_Jarroba_2

Below you have the video tutorial so you can see how debug mode works in Java:

We copy the program code below (we are not sharing the project, since it is a simple example program with no functionality at all):


public class Debuger {

	public static void main (String args[]){

		String primerString = " ";
		int contador = 10;
		boolean flag = true;

		for (int i=1; i<contador; i++){
 			primerString = "Numero "+i;
 			System.out.println(primerString);
 		} 		

 		while (flag){
			primerString = "Numero "+contador;
 			System.out.println(primerString);
 			contador++;
		if(contador>20)
			flag = false;
		}
	}
}

“Debug Mode in Eclipse for Java (Video)” by Ricardo Moya at jarroba.com, licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0. Registered at Safe Creative.

Ricardo Moya

I work in Machine Learning and Big Data. I like learning new technologies and explaining them as clearly as I can on this site.

You may also like

Comments

Leave a comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.