I want to redirect the output of a command "ps -e > /home/workspace/MyProject/List.txt" to JTable
. Is there any way of doing it? If yes, how?
PS: I want this command to be executed continuously until user exits and for JTable
to get updated every time this command executes.
runtime.exec("ps -e > /home/workspace/MyProject/List.txt");
I have used watchservice API to monitor changes in MyProject directory.
So after so many edits, I came to realize that the command doesn't get executed with run.exec() When I execute it from terminal, it goes well but when I run it inside my Java program, no file is created. Can anyone tell me what am I doing wrong with it? I'm using Ubuntu 12.04.