import java.io.Console;
import java.io.IOException;
public class KillProcess
{
private static final String X = " /PID ";
private static final String TSKILL_CMD = "taskkill";
public static void main(String[] args) throws IOException
{
System.out.println("Please input pid:");
Console console = System.console();
if (null != console)
{
int pid = Integer.valueOf(System.console().readLine());
try
{
Runtime.getRuntime().exec(TSKILL_CMD + X + pid);
}
catch (IOException e)
{
e.printStackTrace();
}
}
else
{
System.out.println("");
}
System.in.read();
}
}
import java.io.IOException;
public class KillProcess
{
private static final String X = " /PID ";
private static final String TSKILL_CMD = "taskkill";
public static void main(String[] args) throws IOException
{
System.out.println("Please input pid:");
Console console = System.console();
if (null != console)
{
int pid = Integer.valueOf(System.console().readLine());
try
{
Runtime.getRuntime().exec(TSKILL_CMD + X + pid);
}
catch (IOException e)
{
e.printStackTrace();
}
}
else
{
System.out.println("");
}
System.in.read();
}
}