thread of Program [message #467366] |
Mon, 30 January 2006 13:49 |
Eclipse User |
|
|
|
Originally posted by: ingo.siebertNOSPAM.cas.de
Hi,
first, i want to open a text file. That's working very nice with the
Program class.
Second, i want to know, if the text file has been changed.
But the Program class isn't halting and doesn't return a thread of the
text editor program. Any idea how to solve that problem?
Cheers,
Ingo
|
|
|
|
Re: thread of Program [message #467382 is a reply to message #467378] |
Mon, 30 January 2006 19:08 |
Eclipse User |
|
|
|
Originally posted by: ingo.siebertNOSPAM.cas.de
Hi,
i tried that before, but i didn't get it work. The message "editor
really ended." is display as soon as the text editor is startet.
final Thread t = new Thread(new Runnable() {
public void run() {
Program p = Program.findProgram(".txt");
p.execute("c:/test.txt");
System.out.println("end: editor launch.");
}
});
t.start();
Thread t2 = new Thread(new Runnable() {
public void run() {
while(!t.getState().equals(State.TERMINATED)) {}
while(t.isAlive()) {}
System.out.println("editor really ended.");
}
});
t2.start();
Cheers,
Ingo
Haris Peco schrieb:
> Ingo Siebert wrote:
>
>> Hi,
>>
>> first, i want to open a text file. That's working very nice with the
>> Program class.
>>
>> Second, i want to know, if the text file has been changed.
>>
>> But the Program class isn't halting and doesn't return a thread of the
>> text editor program. Any idea how to solve that problem?
>>
>> Cheers,
>>
>> Ingo
> Ingo,
> try with jdk Runtime classes - you can start process (program) and
> wait for process had terminated - then check status of your text file
|
|
|
Powered by
FUDForum. Page generated in 0.03759 seconds