Java - looking for a tool to force-kill a child process (Windows)

Java - looking for a tool to force-kill a child process (Windows)

hello

I am looking for a Java tool/package/library that will allow me to force-kill a child process.

This tool/package/library must work on Windows platform (mandatory). Support for Linux/Unix is desired.

My Problem

My Java code creates a child process that will simply not react to the standard Java way for killing a child process: process.destroy(), and, since I do not have the child's source code, I cannot program it to better handle termination requests.

I have tried closing the child process' error input and output stream before calling destroy(), and for no effect.

I have even tried passing ctrlBreak signal (char=3) directly into child.getOutputStream(), and again have received the same results.

The workaround i have finally managed to find was to: 1. Obtain the child's PID upon its creation This can be done in Windows by diffinf the process lists before and after the child's creation (getRuntime().exec("tasklist /v")

  1. Use the child's PID to issue a force kill system command
    in Windows: getRuntime().exec("taskkill /pid " + childPid + " /f")

But - this is complex code i have no desire to debug and maintain, plus the problem itself, i have no doubt, was previously encountered by many other java developers, which leads me to the hope that such a Java tool/package/library already exists.

I just don't know its name...

Your help will be appreciated.

Gilad Haimov

PS: My child process was created by Runtime.getRuntime().exec(cmd), but i get the same behaviour using a ProcessBuilder.

View Answers

Ads









Related Tutorials/Questions & Answers:
Parent child windows relationships when webpage is accesssed through a hyperlink.
Parent child windows relationships when webpage is accesssed through... is loaded. The webpage has parent/child windows. This timeout functionality works in the parent window(home page) even when the child windows are open. And so i
Process in Java
Process in Java  how can I execute a java program as a process which i can monitor it in the task manager to see the cpu usage
Advertisements
How to Differenciate Main Thread and Child Thread in Java
Main Thread and Java Child Thread. Please Suggest any example or online link... in Java Programming Language. These are Java Main Thread and the Child Thread...How to Differenciate Main Thread and Child Thread in Java  hi
Running Java Applications as a Windows Service
Running Java Applications as a Windows Service  sample code for "Run a Java application as a Windows Service
Java for Windows
Java for Windows       First of all download jdk for windows and then install and configure the Java SE... the Environment for Java on Windows: This section describes settings
java tool
java tool  I installed edit plus tool but it couldn't compile and excute the coding ...how to retify that problem
process of compiling and running java program
process of compiling and running java program  Explain the process of compiling and running java program. Also Explain type casting
Java get windows Username
Java get windows Username     ... of the windows. System.getProperty("user.name")- This method retrieve the username of the particular system from all the properties of Windows.    
read/write to Windows Registry using Java
read/write to Windows Registry using Java  read/write to Windows Registry using Java
java beginning - Development process
java beginning  sir, i am literaly a beginner and i just want to askthat what are the uses of learning java because i have listened about... the following links: http://www.roseindia.net/java/ http://www.roseindia.net/java
Reading child of child nodes in xml
Reading child of child nodes in xml  Hi I am using the following XML file and would like to read the data for respective date in the child nodes. I.... This is the first time I am calling child of child node. Please help. Thanks in advance
java classpath prbm in windows 7
java classpath prbm in windows 7  i have a problem to set... that user variables i set them like this: CLASS .;C:\Program Files\Java\jdk1.6.0_32\lib; in system variables PATH .;C:\Program Files\Java\jdk1.6.0_32\bin; after
how to access windows registry information using java?
how to access windows registry information using java?  can any one help me how to access windows registry information using java
How to download and install Java 8 on Windows?
How to download and install Java 8 on Windows?  I am beginner in Java going to learn and make program in Java. Is there any tutorial for setting up Java development kit? Tell me How to download and install Java 8 on Windows
Installing NLTK on Windows 10
Installing NLTK on Windows 10 with pip In this tutorial we are going to explains you the steps to install NLTK library on Windows 10 with the pip tool... download Python installer on for windows 10 and then install it on your
Installing NLTK on Windows 10
Installing NLTK on Windows 10 with pip In this tutorial we are going to explains you the steps to install NLTK library on Windows 10 with the pip tool... download Python installer on for windows 10 and then install it on your
JAVA Debug tool
JAVA Debug tool  Hi , I invoke the JDebugTool using the following command on MS DOS : "c:/Users/mkarapanahalli/Programfiles/Java/jdk1.7.0/bin/java..." com.debugtools.jdebugtool.Main That works fine and starts the Debug tool. I mount a source path and try
java (Jpcap Api) - Development process
java (Jpcap Api)  I have a code for how to get packets from a file using JPCAP(java Packet capturing). But i dont know how to assemble those packets as a Single Http packet. Can u please provide the sample code or procedure
java (Jpcap Api) - Development process
java (Jpcap Api)  I have a code for how to get packets from a file using JPCAP(java Packet capturing). But i dont know how to assemble those packets as a Single Http packet. Can u please provide the sample code or procedure
Video Tutorial: How to get windows username in Java
How to get windows username in Java Java is a set of computer software... tutorial of "How to get windows Username in Java?": In this tutorial we will learn how to get windows user name in java in a few easy steps
Windows Mobile Development is Easy to Use When the Right Tools Work
be very easy to work with a Windows Mobile development process... to get the Windows Mobile development process to be easier to handle. The first... the Windows Mobile development process to work. The SDK can also feature a full
Child Filter
Child Filter       Child Filter Child filter basically handles filtration according to parent-child relationship. Some main Child filters are given below : : first-child
parent and child dropdown
parent and child dropdown  Hi, I have one scenario in spring,i need to populate child drop down,based on parent dropdown using spring mvc and ajax... know how to use it in child drop down.How to set that child dropdown in success
Calculate process time in Java
Calculate process time in Java   ... the process time of the completion of the operation through the Java program... for the best illustration of the procedure of calculating the process time in which any
training and placement of my child who is very much interested in doing jobs of his key interests like java, j2ee, php etc,
training and placement of my child who is very much interested in doing jobs of his key interests like java, j2ee, php etc,  I want my son to be trained in java developing ,how should I go
training and placement of my child who is very much interested in doing jobs of his key interests like java, j2ee, php etc,
training and placement of my child who is very much interested in doing jobs of his key interests like java, j2ee, php etc,  I want my son to be trained in java developing ,how should I go
training and placement of my child who is very much interested in doing jobs of his key interests like java, j2ee, php etc,
training and placement of my child who is very much interested in doing jobs of his key interests like java, j2ee, php etc,  I want my son to be trained in java developing ,how should I go
Installing JDK 7 on Windows
windows 7 computer. Check more tutorial for Java beginner in our Java...Installing JDK 7 on Windows - Beginners tutorial for installing configuring... step towards learning the Java Programming Language. This beginners Java
Populating child dropdownlists in JSP/Servlet
Populating child dropdownlists in JSP/Servlet  Populating child dropdownlists in JSP/Servlet
Maven dependency for com.frostwire - jlibtorrent-windows version 1.1.0.34 is released. Learn to use jlibtorrent-windows version 1.1.0.34 in Maven based Java projects
? Steps to use  com.frostwire - jlibtorrent-windows version 1.1.0.34 in Java... that downloads and includes  com.frostwire - jlibtorrent-windows version 1.1.0.34 java... of jlibtorrent-windows released The developers of   com.frostwire - jlibtorrent
Maven dependency for com.frostwire - jlibtorrent-windows version 1.2.0.7 is released. Learn to use jlibtorrent-windows version 1.2.0.7 in Maven based Java projects
to use  com.frostwire - jlibtorrent-windows version 1.2.0.7 in Java... and includes  com.frostwire - jlibtorrent-windows version 1.2.0.7 java library... of jlibtorrent-windows released The developers of   com.frostwire - jlibtorrent

Ads