I've found a couple different examples on how to execute a bat file from java.
I've tried command = a filepath , dos command, and only a file name (no directory)- all of which don't seem to work. The complete filepath doesn't throw an error but it also doesnt execute the bat, while the other two both throw an IO error. I'm using NetBeans 3.6 on XP - any idea what the problem is?
Batch files and DOS commands are not executable. They cannot be run on their own. They must be executed by the command shell, cmd.exe. try:
Keep in mind that the Process returned by exec() has a finite buffer for I/O, so you should really be reading from its input and error streams, otherwise your process may halt without warning. Not to mention the output could be useful for debugging.
I found some help here - I dont really understand what the /E:1900 is but I guess I'm runnin the bat through the cmd.exe like you suggested. This begins to open the program but wont fully open it until I close my java app? I'm still not reading any of the output from the program - could this be the cause?
Note: Program runs after I close my app - doesn't crash. Also, the bat I am running opens another Java application.