Eclipse:停止运行代码(java)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1515226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 13:42:47  来源:igfitidea点击:

Eclipse: stop code from running (java)

javaeclipsejvm

提问by Nick Heiner

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.

有时,我会运行一个不小心包含无限循环或其他东西的程序。Eclipse 会让我继续编辑程序,但速度超级慢。我怎样才能阻止它?(我想重新启动 JVM 吗?)重新启动 eclipse 本身总是有效的,但这会破坏我的工作流程。

采纳答案by SCdF

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

或者,如果您打开 Debug 透视图,您将在(默认情况下)左上角看到所有正在运行的应用程序。您可以选择让您感到悲伤的那个,然后再次按下大红色按钮。在此处输入图片说明

回答by Oliveira

I have a .bat file on my quick task bar (windows) with:

我的快速任务栏(Windows)上有一个 .bat 文件,其中包含:

taskkill /F /IM java.exe

It's very quick, but it may not be good in many situations!

它非常快,但在许多情况下可能并不好!

回答by Snowcrash

For newer versions of Eclipse:

对于较新版本的 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)

  1. 打开调试透视图(窗口 > 打开透视图 > 调试)

  2. 在设备列表中选择进程(右下角)

  3. 点击停止按钮(设备窗格的右上角)

回答by Tia

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

最简单的方法是单击控制台中的终止按钮(红色方块):

enter image description here

在此处输入图片说明

回答by Hari Kanure

For Eclipse: menu bar-> window -> show view then find "debug" option if not in list then select other ...

对于 Eclipse:菜单栏-> 窗口 -> 显示视图,如果不在列表中,则找到“调试”选项,然后选择其他...

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)

它将在控制台选项卡附近添加。使用调试选项卡终止和删除以前的执行。(右键单击执行过程会显示许多选项,包括终止)