Hi I am trying to execute a batch file from within a java application. I do the following: Runtime rt = Runtime.getRuntime(); rt.exec("cmd /c X:\\Java\\WSAD\\workspace\\xrad2\\webApplication\\xrad\\config\\startup.bat"); But the batch file is not executed. A dos prompt is propted, but the batch file is not executed. Any suggestions please?
Joined: Jun 12, 2003
Sorry, this does work. Only the echo in the batch file is not displayed.
Right. Java collects the output from a process and makes it available through the Process object returned by exec(). You can call getInputStream() on the Process to get a stream from which you can read the output. If you want it to go to the screen you can just System.out.print() everything you read.