| Author |
create process problem
|
Ke Li
Greenhorn
Joined: Feb 17, 2004
Posts: 2
|
|
Hi All, I am trying to call another software from my java program. And the source code is: Runtime r = Runtime.getRuntime(); Process p = null; try { p = r.exec("racer.exe"); }catch (Exception e) { System.out.print(e.getMessage()); } The software "racer.exe" must be started in MS-DOS environment and I compile and execute my java program also in MS-DOS environment. Now the problem is there is no error displayed when the program is complied and executed. But actually the software "racer.exe" is not activated. With the same code, I tried to call other software running on Windows environment and it works. I don't know what the problem. Does it because the software and my program both runs on MS-Dos environment? Could you please give me some ideas? Thanks a lot, Best Regards,
|
 |
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18670
|
|
|
Chances are there's an error message for you on the Process' error stream. This is something you have to read yourself with getErrorStream(). But this is best done from a separate thread, since you also (usually) need to read from standard output using getInputStream() and this may be simultaneous. A good solution is presented in this JavaWorld article on common exec() problems. Hope that helps...
|
"I'm not back." - Bill Harding, Twister
|
 |
 |
|
|
subject: create process problem
|
|
|