aspose file tools*
The moose likes Java in General and the fly likes Starting an exec Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Starting an exec" Watch "Starting an exec" New topic
Author

Starting an exec

Tom Hill
Ranch Hand

Joined: Aug 24, 2003
Posts: 115
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

Joined: Oct 25, 2000
Posts: 7292

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...


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Dustinn Yourstone
Greenhorn

Joined: Sep 16, 2005
Posts: 4
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

Joined: Aug 24, 2003
Posts: 115
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Starting an exec