Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I use a 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 ? Or even in Mac OS X itself ?

like image 692
euphoria83 Avatar asked Nov 23 '10 03:11

euphoria83


People also ask

Can we pause the execution in Eclipse?

Since you mentioned you're running Linux, you can use the kill command with the -STOP and -CONT arguments might be a more appropriate option to pause and resume the process. where pid is the PID of your Java process. Another method would be to run your program in debug mode in Eclipse and pause it in the Debug view.

Is there a pause method in Java?

To pause the execution of a thread, we use "sleep()" method of Thread class.


2 Answers

You can suspend any process in Mac OS X (or any Unix) using the kill command to send the SIGSTOP signal to the process.

Find the process ID (pid) for example we'll say it's 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.

like image 78
ocodo Avatar answered Nov 02 '22 06:11

ocodo


You could start the application in debug mode and later pause it before setting the mac osx to sleep.

like image 26
Ricardo Marimon Avatar answered Nov 02 '22 06:11

Ricardo Marimon