java processbuilder example
public static void main(String[] args) {
ProcessBuilder processBuilder = new ProcessBuilder();
// Run this on Windows, cmd, /c = terminate after this run
processBuilder.command("cmd.exe", "/c", "ping -n 3 google.com");
try {
Process process = processBuilder.start();
//This will block other tasks
BufferedReader reader =
new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
int exitCode = process.waitFor();
System.out.println("\nExited with error code : " + exitCode);
} catch (Exception e) {
e.printStackTrace();
}
}
Also in Java:
- unity how to make a gameobject slowly look at a position
- java string regexp replace
- java set value of arraylist
- how to interrupt a void java
- how to take max value from priority queue in java
- foreach map java
- count the number of words in a string java
- nullpointer extension
- boolean java.lang.String.equals(java.lang.Object)' on a null object reference
- get drawable with string android java
- how to close a jframe in java with an if statement
- java jpa criteriabuilder in xample
- ceil function in java
- time conversion solution
- find the day of the week Calendar class in java
- how to select a random element from an array in java
- android studio keep device awake
- isnumber java
- clear stringbuilder java
- java array to list
- Diamond Shape Pattern Program in Java
- hashmaps java
- processing sound android
- number to char java