Maian Maian - 5 months ago 91
Linux Question

How to cleanly shutdown Eclipse from Linux command line?

Is there a way to shutdown Eclipse cleanly from the command line, such that files and workspaces are saved? kill -3 doesn't do anything. kill -1 and kill -15 (default) causes Eclipse to exit abruptly with JVM termination popup. kill -9 does the same thing.

The use case is that I'm working remotely on a machine with Eclipse loaded on it, and I want to save memory by closing Eclipse, but I want Eclipse to save its state first.

I could use VNC or some alternative desktop sharing software, but that's really heavy-weight, and I'd much prefer a command line solution.

EDIT: System info: RHEL5.1 64-bit using GNOME


Any added ShutdownHooks (more info here) should be executed by the JVM when terminated by SIGTERM. Therefore, I think the problem is the way Eclipse is programmed to deal with such signals.

As I don't know how the cleanup process is implemented in Eclipse, I can only assume that it is not called by any ShutdownHook (and rather by an Action or something similar).

Edit: pidge has provided an answer below however which details steps which should allow you to shutdown Eclipse cleanly from the command line.