简体   繁体   English

有没有办法在Macbook Pro上暂停Eclipse中正在运行的Java程序的执行?

[英]Is there a way to pause execution of a running Java program in Eclipse on Macbook Pro?

I use a MacBook Pro. 我用的是MacBook Pro。 Sometimes I want to pause the execution of a long heavy-duty experiment running on my system because I am on battery or for any other reason. 有时我想暂停执行在我的系统上运行的长时间重型实验,因为我正在使用电池或出于任何其他原因。 Is there a way to do it in Eclipse ? 有没有办法在Eclipse中做到这一点? Or even in Mac OS X itself ? 甚至在Mac OS X本身?

You can suspend any process in Mac OS X (or any Unix) using the kill command to send the SIGSTOP signal to the process. 您可以使用kill命令暂停Mac OS X(或任何Unix)中的任何进程,以将SIGSTOP信号发送到进程。

Find the process ID (pid) for example we'll say it's 9281. 找到进程ID(pid),例如我们会说它是9281。

kill -SIGSTOP 9281

and to resume... 并恢复......

kill -SIGCONT 9281

To find the pid, use the ps command, ps -a will list all running processes, your process will be a java instance running your app. 要查找pid,请使用ps命令, ps -a将列出所有正在运行的进程,您的进程将是运行您的应用程序的java实例。

您可以在调试模式下启动应用程序,然后在将mac osx设置为sleep之前暂停它。

If you have already started the application, the best you can do is to use kill -STOP from the command line. 如果您已经启动了应用程序,那么您可以做的最好是从命令行使用kill -STOP You may need to do this to the eclipse process itself if the application is running in the eclipse jvm. 如果应用程序在eclipse jvm中运行,您可能需要对eclipse进程本身执行此操作。

If the process is contained (no internet connection, no external dependency) just go to sleep or close the computer. 如果包含进程(没有Internet连接,没有外部依赖),只需进入睡眠状态或关闭计算机即可。 It will be resumed after you turned it on. 打开后它将恢复。

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

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