import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class ListarProcessosWindows {
public static void main(String[] args) {
try {
String command = "c:\\windows\\system32\\tasklist.exe";
Process child = Runtime.getRuntime().exec(command);
InputStream in = child.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
ArrayList
String linha = "";
while( ( linha = reader.readLine() ) != null ){
String[] str = linha.split(" ");
saida.add(str[0]);
}
in.close();
for (String s : saida) {
System.out.println(s);
}
} catch (IOException e) {
}
}
}
Um comentário:
Esse código tá com um erro...
Postar um comentário