Reputation: 161
I have a batch file that checks out code from SVN and calls few commands on it.This happens on the windows command prompt. I want to call this batch file from my java program and the command prompt must be present in the console of my application window and not as a separate window so I can see the output of the batch from my application.
Can anyone tell me how to include the command prompt to my console? I am using Swing.
Upvotes: 2
Views: 1033
Reputation: 9941
I haven't tried it myself, but wouldn't it be enough if you start the Program from your java code and print the results of the PrintStream of that Process to your console (stdout)?
Upvotes: -1
Reputation: 168825
If all you want is to see the output, forget the command prompt.
ProcessBuilder
.Process
.MessageConsole
.BTW - When (not if) you run into problems using a Process
, see When Runtime.exec() won't & implement all the suggestions.
Upvotes: 5
Reputation: 5427
Answer is "no, you can't do that".
Java cannot display a native program's GUI within a JFrame, even if the target program was actually architected to allow it's GUI to be presented within another program's frame. You might get succeed if you use JNI program.
Upvotes: 3