简体   繁体   English

有没有办法暂停/恢复Windows上Eclipse中正在运行的Java程序的执行?

[英]Is there a way to pause/resume execution of a running Java program in Eclipse on Windows?

In Linux, it's possible to pause/resume execution using kill.在 Linux 中,可以使用 kill 暂停/恢复执行。 Is there a way to do that on Windows?有没有办法在 Windows 上做到这一点?

You can go to Eclipse console and click red square for the process you want to stop.您可以 go 到 Eclipse 控制台,然后单击要停止的进程的红色方块。 The different processes running are available in dropdown on console itself.运行的不同进程在控制台本身的下拉列表中可用。

Many a times, processes like SVN synch etc. just hang up and user has to close Eclipse itself and restart it.很多时候,SVN 同步等进程只是挂起,用户必须关闭 Eclipse 本身并重新启动它。 This is something observed in Eclipse version 2020 as well.这也是在 Eclipse 版本 2020 中观察到的情况。

On linux, kill command doesnt pause the process, instead it kills its pid and stops the process.在 linux 上,kill 命令不会暂停进程,而是杀死其 pid 并停止进程。

To do the same on Windows:在 Windows 上做同样的事情:

You must use Task Manager (Alt+Ctrl+Del on Windows) to kill process.您必须使用任务管理器(在 Windows 上为 Alt+Ctrl+Del)来终止进程。 Go to tab Processes, find process javaw.exe* and click End Process. Go 到选项卡进程,找到进程 javaw.exe* 并单击结束进程。 javaw.exe is the java process without any console. javaw.exe是没有任何控制台的java进程。

So, process in Eclipse will be closed but your Eclipse will not be closed.因此,Eclipse 中的进程将关闭,但您的 Eclipse 不会关闭。

Kill on Linux actually stops the process, you cannot resume it. Kill on Linux 实际上停止了这个过程,你不能恢复它。

If it's a console application and you just want to pause at a certain known execution point in your code, just use a Scanner and wait for a user's input如果它是一个控制台应用程序并且您只想在代码中的某个已知执行点暂停,只需使用扫描仪并等待用户输入

Scanner scanner = new Scanner(System.in);
scanner.nextLine();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM