aspose file tools*
The moose likes Java in General and the fly likes Cannot see exec()'ed app 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 "Cannot see exec() Watch "Cannot see exec() New topic
Author

Cannot see exec()'ed app

Brian Coates
Ranch Hand

Joined: Jul 03, 2001
Posts: 42
When I exec an application, a cmd window with a helloworld app that spits out the string "Hello World", I can't actually see the cmd window. I'm using the '/k' flag, which if I understand correctly, should keep the cmd window open. I've also tried exec'ing a text file in notepad.
In both cases, I could see a cmd/notepad process start in the Process Window of the Task Manager, but the windows never actually popped up.
Anyone know why? Below is a snippet of my code.
thanks,
brian
String path = "d:\\";
String command = "cmd /k java -classpath \"" + path + "\" HelloWorld";
Process p = Runtime.getRuntime().exec(command);
- OR -
String command = "notepad c:\\text.txt";
Process p = Runtime.getRuntime().exec(command);
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Worked for me in WinNT. I got two windows up, of course the notepad window came up first and couldn't find that file. Then the java window came up just fine.

I used this code:

[This message has been edited by Cindy Glass (edited December 14, 2001).]


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot see exec()'ed app
 
Similar Threads
Running a program from a Java Application
Start and Stop tomcat from Java Program
Display a file in Notepad
Runtime getRuntime() exec(String command) - How does this work?
How Direct Runtime.getRuntime().exec output to Console window ??