Reputation: 584
I am creating a Java swing GUI, which takes few parameters from user (through text fields) and stores them in a string called finalstring
. This string is basically a command, which runs an ".exe" file with few parameters. Now i want to create a batch file(start.bat on my desktop), in which i want to copy this string. Finally i want to execute this batch file. Along with the execution, i also want to store the output of this batch file.
Also, the batch file executes certain process, which i want to link with progress bar, is this possible?(process running in batch file, to be linked to java swing's progress bar?).
I did all above things using python and tkinter as GUI, but during the storage of output of batch file, my tkinter gui used to hang(not responding), so i am switching to java swings GUI. I searched most of the online threads, but nothing is going in my head(created few java programs also, but the batch file is not being created), so i want help, i appreciate your effort to go through this thread.
Upvotes: 0
Views: 792
Reputation: 205875
You can execute your batch using ProcessBuilder
, as shown here. You can append()
lines from the combined output stream to a JTextArea
, as shown here.
I'm not sure you can usefully display progress in a JProgressBar
without knowing more about the granularity of the process.
Upvotes: 1