The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Killing a process

Posted by tom on November 20, 2001 at 8:15 AM

Hi Matt Gerrans,
sounds interesting but as u mentioned sounds comlecated as well. but unfortunately i am not in a state to hire yet. :)
i would be greateful if you could explain the process little bit more. here is what i would like to do.

i have a interface with lots of buttons. each button starts one corba object. i am starting it using batch files. so whenever i click a button a batch file is started which starts the corba object. now i need to kill the corba objects.

hope u will solve my problem.

> This is kind of amusing. This question was just being discussed in the borland.public.cppbuilder.winapi. In other words, most C/C++ programmers can't figure out how to do this, having direct access to the Windows API and you guys want to do it from Java.

> There may be a pure Java way, but I doubt it, since this is a pretty platform-specific type of thing. So the answer is, create youself a native method that does PostMessage(WM_CLOSE) to the main window of the thing. If the program is a console app (has no window), or if it doesn't respond as desired to the WM_CLOSE request (it is a request, not a command), then use TerminateProcess() on it, which will kill it summarily.

> If this all sounds too compilicated and difficult, the easy thing is to hire me to do it for you! ;-)

> - mfg

> > Hi,
> > looks like everyone has the same problem. let me know if anyone of you know how to kill it.
> > regards
> > tom

> > > Hi Anand,

> > > I would like know how to kill the exe process running which is started by process.runtime.exec. The process.runtime.destroy method does dismantle the process object, but the subprocess is still running. I have check this by putting the subprocess in contineous while loop. Please advice.

> > > Thanks in advance,

> > > Alik

> > >
> > > > Hi Anand,
> > > > Could you tell me if you find a way to kill a process in Java ?
> > > > Please, let me know. Thanks a lot.
> > > > Best Regards,
> > > > Franck.

> > > > > I wanted to know whether a process (any .exe file)is running and if it does, then I would like to destroy it. I know how to start a process using the Runtime.getRuntime.exec("someexe.exe"). But how do I find out if "someexe.exe" is running and then kill/destroy it. Thanks in advance.

> > > > > Anand


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us