PROCESS
EXAMPLE 4: TO LIST ALL THE PROCESS
import java.io.*;
public class Tolist {
public static void main(String[] args)throws
IOException
{
Runtime runtime = Runtime.getRuntime();
String cmds[] = {"cmd", "/c", "tasklist"};
Process proc = runtime.exec(cmds);
InputStream inputstream = proc.getInputStream();
InputStreamReader inputstreamreader = new
InputStreamReader(inputstream);
BufferedReader bufferedreader = new BufferedReader(inputstreamreader);
String line;
while ((line = bufferedreader.readLine()) != null) {
System.out.println(line);
}
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.