Here you can find the source of killProcessWithArgs(List
Parameter | Description |
---|---|
args | a parameter |
private static void killProcessWithArgs(List<String> args)
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { /**//from w ww . ja va2 s . c om * * @param args */ private static void killProcessWithArgs(List<String> args) { List<String> list = new ArrayList<>(); list.add("/usr/bin/pkill"); list.addAll(args); try { Process child = new ProcessBuilder(list.toArray(new String[list.size()])).start(); child.waitFor(); } catch (InterruptedException | IOException e) { throw new RuntimeException("Can't kill process: " + e.getMessage()); } } }