54

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.

Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
  • It's a pretty old question..but...there is a very basic approach that seems to be missing here so: Don't forget that you can use **System.exit** from within your code to terminate the program when required (no devops scripts are required). Read more about it here: https://stackoverflow.com/questions/3715967/when-should-we-call-system-exit-in-java – ymz Jan 07 '18 at 13:40

5 Answers5

87

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.enter image description here

aqavi_paracha
  • 1,131
  • 2
  • 17
  • 38
SCdF
  • 57,260
  • 24
  • 77
  • 113
13

For newer versions of Eclipse:

  1. open the Debug perspective (Window > Open Perspective > Debug)

  2. select process in Devices list (bottom right)

  3. Hit Stop button (top right of Devices pane)

Snowcrash
  • 80,579
  • 89
  • 266
  • 376
  • Also, if the process is stopped by Eclipse but your swing windows are still running you can click the 'remove launch' or 'remove all terminated launch' x's to kill the windows. – Automate This Nov 26 '13 at 05:38
7

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!

Oliveira
  • 1,281
  • 1
  • 11
  • 19
2

The easiest way to do this is to click on the Terminate button(red square) in the console:

enter image description here

Tia
  • 1,220
  • 5
  • 22
  • 47
0

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)