wood burning stoves 2.0*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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
Author

Executing MSDOS command with flashing MSDOS-Window

Pardha Saradhi Janaswami
Greenhorn

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...
Regards,
Saradhi.
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Executing MSDOS command with flashing MSDOS-Window
 
Similar Threads
Is this possible? 2 consoles?
Releasing the JRE
how a java program compiles and runs?
Multiple Consoles in Eclipse
Java Compilation at MSDOS prompt