Running Java from a Windows batch file causes the batch file to stop
- by jjkparker
When I run Java from a Windows .cmd file (Vista 32-bit here), the Java command causes the batch file to stop executing additional commands.
For example, this is a simple test.cmd file:
java
java
This should cause Java to print its help message twice. However when I run it in cmd.exe, I get this:
C:\>test
C:\>java
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -client       to select the "client" VM
    -server       to select the "server" VM
...
C:\>
The batch file simply exits when Java exits. What's going on here?