This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Starting an exec

 
Tom Hill
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to start a Command Prompt using Runtime.exec()

I know its possible to start applications running and i know you can use cmd /c to start a command terminal inside of java.

I would quite like to actually start a terminal up, so that if a user was watching the machine a terminal would appear for them. Any ideas?

Tom
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of event would trigger the terminal popup? There has to be some kind of input so the system knows when to do this...
 
Dustinn Yourstone
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I think you can. Of cource you can just start up "cmd" and then you can set a printwriter output stream to that window and type out what you want. I have seen that done before, but I never done it myself. You could always cheat and use the Robot class though .
 
Tom Hill
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive discovered that cmd /c start /D<dir> <command> is a way of doing it. It may be necessary if you wish to close the existing terminal and start a new one.
Cheers

Tom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic