At what point does it totaly hang your application? Does the call to exec return you a process instance or is this the point that it hangs?
The process instance contains an error stream and an output stream, according to the API documentation you need to be reading these or the application could block. Is there any information being reported on either of the streams?
The run.bat script needs to be executed with the working directory being the directory that contains the run.bat script, in your invocation to exec you have not set the working directory, where is your applications working directory?
you shoud use: START C:\.....
The run.bat is never ending
Thank you very much Darranl. You are right. When I put my application class under jboss/bin directory and exec "run.bat", then it works. It's my fault, we can not call run.bat outside bin directory.
Thanks again. However, just wonder if it a good approach? now I have issues to stop jboss.
1. in my application, I'm using process.waitFor() and, it will never return until jboss terminated, so, I can not use waitFor(), but using some sleep() to wait for jboss get started.
2. because I started jboss through my java application, after my application finished, there is no console window for jboss running. Which means I can not stop jboss by sending "CTRL-C", instead, I should write another application to call jboss stop script instead.
3. runtime.exec() will get jboss started in a separate JVM, am I right? will that bring some issues?
Is there any other options? Highly appreciated if any suggestions
Thanks a lot
Thank you fbiaggi, I guess your reply answered my questions in my previous reply. sorry I submitted my previous reply without checking your reply. I'll try to call "start run.bat" instead.
Thanks a lot again