wood burning stoves
The moose likes Java in General and the fly likes Executing MSDOS command with flashing MSDOS-Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Executing MSDOS command with flashing MSDOS-Window" Watch "Executing MSDOS command with flashing MSDOS-Window" New topic

Executing MSDOS command with flashing MSDOS-Window

Pardha Saradhi Janaswami

Joined: Sep 05, 2003
Posts: 7
Dear All,
I want to execute the java program which calls the subclasses. The output of the subclasses should be displayed on different MSDOS-Window Consoles. For this i am using the following piece of code....
Process proc=Runtime.getRuntime().exec("cmd /c start /k java test.SubClass1");
But I am not able to see different Consoles, though it had created the new process and excuted the program.
My O.S Environment is Win2000 and the java version is 1.4
Advance TX for the suggestion given...
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Going through runtime.exec that way will create a whole new instance of Java, a new JVM, all that good stuff. Is that really necessary? If you can run in the same JVM just call your class with SubClass1.main(someStringArray).
I don't know of any way to open a console window with runtime.exec. It always runs things invisibly. You could connect streams to the stdout, errout and stdin of the running process and build your own window that looks a lot like a command window, but that's pretty complicated!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link: http://aspose.com/file-tools
subject: Executing MSDOS command with flashing MSDOS-Window
It's not a secret anymore!