• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Problems with getInputStream() [Java]

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Shelnutt2

Overclockers Team Content Editor
Joined
Jun 17, 2005
Location
/home/
I'm writing a quick program that get the list of processes running. I'm hitting a snag. When I compile it says "cannot find symbol method getInputStream()" I'm not sure what I've done wrong. I'm sure I just didn't initialize it correct.

Thanks!


Code:
import java.io.*;
 
public class Processes{
	
	public static void main(String args[]) throws IOException   {
	
	Runtime	p = Runtime.getRuntime();
	p.exec("tasklist");
 
	BufferedReader procInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
	
	}
}
 
ShadowPho said:
I didnt get to runtime in Jave, but maybe it is InputStream instead of getInputStream: p.InputStream(); instead of p.getInputStream?

I tried. I get the same error (except it says InputStream, instead of getInputStream).
 
Trombe said:
It's deprecated, but perhaps "getLocalizedInputStream()"

Thanks but that didn't fix it.....

:rolleyes: :rolleyes:

This was such a dumb mistake..

Code:
Runtime	p = Runtime.getRuntime();

need to be change to
Code:
Process	p = Runtime.getRuntime();

Someone over at devshed.com pointed that out. Now its working ok..

Now to work on the rest..
 
Back