> Hello Everyone,
> After realizing I'm spending way to much time playing games I decided
[quoted text clipped - 10 lines]
> Can anyone point me in the right direction on how best to kill off the
> application once the time runs out?
Try reading the javadocs for the classes you are using.
For example, if you are using the Process class, you should read
http://java.sun.com/javase/6/docs/api/java/lang/Process.html
- Oliver
> Hello Everyone,
> After realizing I'm spending way to much time playing games I decided
[quoted text clipped - 5 lines]
> I have it all going now with the exception of killing the specified
> game.
So I assume you already now how to launch an external process
from Java...
> The assumption that I made (evidently a bad assumption on my part),
> was that simply exiting the java app would kill the running child
> app. This does not seem to be the case.
> Can anyone point me in the right direction on how best to kill off the
> application once the time runs out?
If you're playing WoW on Linux or OS X, "kill -9" will do the job
in a cruel way... All you need to know is the PID of the process,
which you can easily find using the output of ps.
If you're on Windows, then I'd recommend the free and
excellent "pskill.exe" for http://www.sysinternals.com
(for pskill.exe you simply need the name of the process,
which should always be the same for, say, WoW).
I'm using it since years for several Windows version and it
works like wonder.
That said, launching a Java app and keeping a JVM running
just as a timer seems overkill. I'd go with a bash/shell script
running in the background.
alexandre_paterson@yahoo.fr - 20 Apr 2007 01:03 GMT
replying to myself...
As explained in the Process JavaDocs, as you're in
control of the process you created Process's destroy()
method MAY do what you want. However in won't
work for every process launched by Java' Process
facility (this is explained in the JavaDocs).
So, check if Process's destroy() method works *in
your case*... Otherwise check kill / pskill.exe.