Write to file, see updates as you go.

J

JasonDamianUs

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
(e-mail address removed)
 
A

Andrew Thompson via JavaKB.com

JasonDamianUs said:
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.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200704/1
 
S

Sanjay

Andrew said:
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.

Eclipse does that too. So does Quanta, kate or gedit on Linux.
 
J

JussiJ

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.
 
G

Gordon Beaton

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

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,689
Members
48,796
Latest member
Greg L.

Latest Threads

Top