I\'m working on JTable that reads text from a .txt file. the txt file gets updated dynamically after 3 sec. Now when I run the application, everything is good except that th
I'd do this a little differently, avoiding an intermediate text file. Instead,
Use ProcessBuilder, which "can be invoked repeatedly from the same instance." You can read the output as shown here and parse it into a suitable data structure, e.g. List.>
ProcessBuilder pb = new ProcessBuilder("ps -ef");
Start a javax.swing.Timer having a three second period; invoke pb.start() in the timer's listener.
When parsing concludes, fireTableDataChanged() in your AbstractTableModel, shown here.
Presto, your table updates with the latest result every three seconds.