Search code examples
javaspringeclipsevisual-studiospring-tool-suite

How to debug Java code in IDE (Eclipse, Spring Tool Suite) like Visual Studio?


First of all, I know my question is not a good question, I should say sorry for my this question, but this question confused me for a long time.

.Net/Visual Studio: I am coming from a .Net background. When I develop a project, I and my team are using the Visual Studio. When I debug the server side code (C# class code), it is very convenient since I use Visual Studio. I set the breakpoint, then I hover my mouse above the code, I can see what is the value of a variable or array values of a variable, so I can quickly know what is the value of a variable.

Java/Eclipse/Spring Tool Suite: When I was a student, all my courses are using Java with Eclipse, including course assignment and projects, and I found it was not convenient for debugging. Because I need to go to a debug mode, then I need to see a separate Windows enter image description here within Eclipse, which shows the value of a variable in each row, this is not very efficient way to debug compared to debug in Visual Studio.

Now, I am going to develop the project using Java. This project is based on Spring framework. Then I found many people are using Spring Tool Suite, so I am going to use this IDE to develop my project.

My question is: Can we debug Java in an IDE like we debug in Visual Studio? What about debug code in Spring framework using Spring Tool Suite? Thanks.

Update: All right, enter image description here. I am testing this easy java program in Eclipse. I set the breakpoint, then I click "Run" -> "Debug", then I open a debug perspective. In the past, I only can see what is the value for variable a and b in Red Circle 2, but now, look like recently, when I put my mouse on variable a and b in Red Circle 1, I can see its value immediately? If yes, when this feature added to Eclipse? I am quite sure we cannot do so in Eclipse in the past.


Solution

  • Once you are actually debugging an application, you can hover over a variable in an open editor for the selected stack frame in the Debug view and see the variable's value. This is a long available feature.

    You can also drag a view, using its title bar, out of the main window to create a new window if you want. I don't think this is heavily used, and may not work correctly with multiple screens, but it's there.