This should be a simple question, but I am not sure how to do it
without opening and closing the file every time.
I want to be able to write lines to a file in Java, and watch the
progress in my text editor as I go.
The only was I can see so far is the close and re-open after every
write. This of course must be resource intensive...
Help is appreciated.
Jason
jasonus@gmail.com
Andrew Thompson - 02 Apr 2007 06:42 GMT
>This should be a simple question, but I am not sure how to do it
>without opening and closing the file every time.
>
>I want to be able to write lines to a file in Java, and watch the
>progress in my text editor as I go.
This depends largely on your text editor.
For example, I will usually open Ant ouptut logs in
TextPad. Whenever I 'flip to' TextPad and there is
more data, the app. will prompt me with WTE
'The file has been updated, do you want to
reload it?'
What OS are you running? TP is available for
Windows, though I expect there are similar text
editors available for Mac & *nix.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Sanjay - 02 Apr 2007 16:15 GMT
>> This should be a simple question, but I am not sure how to do it
>> without opening and closing the file every time.
[quoted text clipped - 12 lines]
> Windows, though I expect there are similar text
> editors available for Mac & *nix.
Eclipse does that too. So does Quanta, kate or gedit on Linux.
Andrew Thompson - 02 Apr 2007 19:16 GMT
>>> This should be a simple question, but I am not sure how to do it
>>> without opening and closing the file every time.
..
(auto-updating text editor)
>> ...I expect there are similar text
>> editors available for Mac & *nix.
>
>Eclipse does that too. So does Quanta, kate or gedit on Linux.
(chuckle) Yes.. Perhaps I should have said
"almost anything that is not 'Notepad'", but I
did not want to make too many presumptions. ;-)

Signature
Andrew Thompson
http://www.athompson.info/andrew/
JussiJ - 03 Apr 2007 00:59 GMT
> This should be a simple question, but I am not sure how to do it
> without opening and closing the file every time.
>
> I want to be able to write lines to a file in Java, and watch the
> progress in my text editor as I go.
The Zeus editor will automatically reload any unchanged file each
time you activate the editor:
http://www.zeusedit.com
By 'unchanged file' I mean any file loaded in the editor but
not modified. If the file has been modified the user is prompted
before the file is reloaded.
> The only was I can see so far is the close and re-open after every
> write. This of course must be resource intensive...
Another option would be run the Java app in Zeus as a tool or via
a macro script and have Zeus capture the output as the app runs:
http://www.zeusedit.com/forum/viewtopic.php?t=74
http://www.zeusedit.com/forum/viewtopic.php?t=536
Jussi Jumppanen
Author: Zeus for Windows IDE
NOTE: Zeus is shareware.
Gordon Beaton - 03 Apr 2007 06:29 GMT
> I want to be able to write lines to a file in Java, and watch the
> progress in my text editor as I go.
Emacs can "tail" a file - it can watch the file for changes and
automatically update the buffer as the file is written, keeping the
cursor at the bottom so you always see the latest changes.
Of course it's easier just to run "tail -f" in a shell.
/gordon
--