Question:
Using VCafe 2.8 in a Win95 enviornment, I’m trying to spawn a local executable during the runtime of a Java application. I’ve tried using:
Process p = Runtime.getRuntime().exec(strCmd);
but the only value of “strCmd” that was successful was strCmd = "c:command.com /c dir"
I’m really trying to run something like Windows Notepad, or even a *.bat file.
Answer:
The only reason you found you had to usecommand.com to invoke a program is because thecommand you used in your test program is not anactual executable. The dir command is part of the command.com shell and cannot be executed separately. If you change your command string to “C:WINDOWSNOTEPAD.EXE”, you should have no problem launching the program. But when executing shell commands like dir, you must invoke command.com.