Dear Developers, Hope you can help with the following: I can successfully get the "dir" contents in the same way I do at the DOS prompt by doing the following: Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("cmd /c dir"); I can also run a perl script via: Process proc = runtime.exec("cmd /c perl MyPerl.pl"); HOWEVER, the command I need to run is "ss.exe" which is part of VisualSource Safe. At the command prompt, I use this command with the "dir" argument to get a directory listing of the current Visual SourceSafe Database as follows: c:\temp>ss dir and I get the results in here. For some reason, this does not work in Java: Process proc = runtime.exec("cmd /c ss dir"); I do not get an exception by doing this, and I tried to redirect the output to a file by: Process proc = runtime.exec("cmd /c ss dir > out.txt"); The file "out.txt" gets created, but it is empty!! How could I invoke Visual Source Safe command line arguments via Runtime.exe?? Thanks! --Cecilia.
Joined: Feb 17, 2003
I've always had better luck running a .bat file than the actual command. I suspect the problem is that 'ss.exe' is not a recognized command to the process that runs it. It works from dos because you have path variables set. When you try it again type the full path to the executable whether you use a .bat file or not this may help. Also, if you don't wait for it to finish before closing things this could be a problem as well.
Joined: Jan 30, 2000
I agree with all Lu's points. Additionally, there may be an error message being generated but not read. Process has a getError() method which allows you to read this. It's often easier to redirect the error output to a file, much like you've done for standard output: