Eclipse: stop code from running (java)
JavaEclipseJvmJava Problem Overview
Sometimes, I'll run a program that accidentally contains an infinite loop or something. Eclipse will let me continue editing the program, but be super slow. How can I stop it? (Do I want to restart the JVM?) Restarting eclipse itself always works, but that breaks my workflow.
Java Solutions
Solution 1 - Java
Open the Console view, locate the console for your running app and hit the Big Red Button.
Alternatively if you open the Debug perspective you will see all running apps in (by default) the top left. You can select the one that's causing you grief and once again hit the Big Red Button.
Solution 2 - Java
For newer versions of Eclipse:
-
open the Debug perspective (Window > Open Perspective > Debug)
-
select process in Devices list (bottom right)
-
Hit Stop button (top right of Devices pane)
Solution 3 - Java
I have a .bat file on my quick task bar (windows) with:
taskkill /F /IM java.exe
It's very quick, but it may not be good in many situations!
Solution 4 - Java
The easiest way to do this is to click on the Terminate button(red square) in the console:
Solution 5 - Java
For Eclipse: menu bar-> window -> show view then find "debug" option if not in list then select other ...
new window will open and then search using keyword "debug" -> select debug from list
it will added near console tab. use debug tab to terminate and remove previous executions. ( right clicking on executing process will show you many option including terminate)