Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Swing, tail -f and threading
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Thomas Weidenfeller, post: 569452"] A couple of things: 0. As mentioned a thousand times in this newsgroup, please provide complete (has a main(), compiles, runs), small source code, not snippets. On reason: See next point 1. You don't show the way you run exec(). It might well be that you block something there. You would at least have: - a thread to read from stdout of the external program - another thread to read from stderr of the external program (very popular to forget this) And if you provide input: - thread nbr. three, if you don't want to block your current thread Also: - possibly a waitFor() in your current thread so you get informed when the external program terminates. 2. This is doomed to block the EDT. What you are in fact doing is you schedule one callback on the EDT (your Runnable). The run() method gets at some point in time executed on the EDT. So your while() loop starts running in the EDT. You while() loop runs "endlessly", effectively blocking the EDT for every. class TextAreaUpdater implements Runnable { JTextArea ta; String line; public TextAreaUpdater(JTextArea ta, String line) { this.ta = ta; this.line = line; } public void run() { ta.append(line); : [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Swing, tail -f and threading
Top