| Author |
how to retrieve the value of ps - A command
|
baran tamer
Ranch Hand
Joined: Jan 22, 2009
Posts: 33
|
|
Hello , i am trying to get the pid of a process which i know is unique
My code below is not working for "ps - A | grep vlc" , however it works for "ifconfig"
output returns null . Any ideas ?
|
 |
Dmitry Mamonov
Greenhorn
Joined: Dec 24, 2008
Posts: 28
|
|
Is it works with only:
String commandToBeExecuted = "ps -A";
?
|
 |
Dmitry Mamonov
Greenhorn
Joined: Dec 24, 2008
Posts: 28
|
|
Code above works fine. May be grep command eliminates all rows?
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
Hi there,
As an extra, have a read of the Javaworld article "Why Runtime.exec() won't", it's a very important set of guidelines when dealing with this sort of thing.
|
Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
"ps - A | grep vlc" is not one command - it's two commands, with the output of the first used as input for the second.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: how to retrieve the value of ps - A command
|
|
|