Here you can find the source of killProcess(String name)
public static void killProcess(String name)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void killProcess(String name) { try {/* w w w . ja v a 2 s.co m*/ ProcessBuilder processBuilder = new ProcessBuilder("taskkill ", "/IM", name); // processBuilder.directory(new File(image.getParent())); Process process = processBuilder.start(); BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = null; try { while ((line = br.readLine()) != null) { } } catch (Exception e) { e.printStackTrace(); if (br != null) { br.close(); } } } catch (Exception e) { } } }