publicstatic String join(String separator, String[] elts) {
String result = elts[0]; for (int i = 1; i < elts.length; ++i)
result = result + separator + elts[i]; return result;
}
publicstaticvoid checkExitValue(String[] commandArgs, int expectedExitValue) throws Exception
{ if (! (new File(commandArgs[0]).exists())) return;
System.out.println("Running command: " + join(" ", commandArgs));
Process proc = Runtime.getRuntime().exec(commandArgs); int val; byte[] buf = newbyte[4096]; int n = proc.getErrorStream().read(buf); if (n > 0) thrownew Exception
("Unexpected stderr: "
+ new String(buf, 0, n, "ASCII")); if ((val = proc.waitFor()) != expectedExitValue) thrownew Exception
("waitFor() returned unexpected value " + val); if ((val = proc.exitValue()) != expectedExitValue) thrownew Exception
("exitValue() returned unexpected value " + val);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.