code: public static void killProcess(String pid) {
  
      //If process tree is not alive then return immediately.
      if(!ProcessTree.isAlive(pid)) {
        return;
      }
      String[] args = { "kill", "-9", pid };
      ShellCommandExecutor shexec = new ShellCommandExecutor(args);
      try {
        shexec.execute();
      } catch (IOException e) {
        LOG.warn("Error sending SIGKILL to process "+ pid + " ."+ 
            StringUtils.stringifyException(e));
      } finally {
        LOG.info("Killing process " + pid + " with SIGKILL. Exit code "
            + shexec.getExitCode());
      }
    }
docs: Sends kill signal to process, forcefully terminating the process.
  
  @param pid process id