Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Juana Fisher   on Aug 02 In Java Category.

  
Question Answered By: Sairish Kauser   on Aug 02

you can get a reference to the process like this

Process p = Runtime.getRuntime().exec("/usr/bin/top");

then read its output something like this

BufferedReader reader;
reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

you could try using the getOutputStream() method to get an OutputStream you
could write your 'q' or control-c command to the 'top' process.

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Running system commands from within Java Or get search suggestion and latest updates.


Tagged: