how to monitor external applications(like notepad/word/exce/media players..) from java
+1
A:
If you start them yourself with the Runtime
class, you can probably monitor them that way.
But, if they're started outside of your control, WMI is the way I'd go.
The Win32_Process class is the one you're looking for, and this page details how to do it in Java/JACOB (Java COM Bridge).
paxdiablo
2009-05-12 06:27:47
thankswhat exactly i want is whenever a fault occurs while running notepad/word/... , how to detect it
2009-05-12 06:41:28
As the answer said, it depends on whether your Java process is starting the app. If it was, you'd be notified of a return value but it doesn't sound like that's what you want. It's going to be difficult, if not impossible, for an external program to tell whether an application crashed or exited cleanly.
paxdiablo
2009-05-12 06:48:43
yeah you are getting it right i am not starting the application from my program but still i want the exit status of that application. Is there any way to do it even i m trying it from past one week and i m in no mans land.Please help me to sort it out
2009-05-12 07:03:23
Not through WMI, I don't believe it holds information once the processes have exited so, while you can tell they've disappeared, you can't tell why. I can think of a kludge that involves replacing notepad.exe with some of your own code which would call the real one and wait but, before we go down that path to insanity, can you tell us why you need this? There may be a better way.
paxdiablo
2009-05-12 07:21:32
the objective is to capture the fault if it has occured and store it in DB.If any other go is also acceptable
2009-05-12 07:27:50
A:
I don't know what exactly you mean by monitoring and I am guessing that you are referring to a Windows platform. The only way to do something like this is to use a COM interface. Have a look at the JACOB project.
kgiannakakis
2009-05-12 06:27:59