Windows executing bat/cmd

Alan Bateman Alan.Bateman at oracle.com
Sun Oct 5 19:12:29 UTC 2014


On 04/10/2014 19:12, Bernd Eckenfels wrote:
> :
> This creates the interesting situation, that the JVM verifies stricter
> if you not use the (Microsoft recommended) "cmd /C". (In fact the
> implementation even documents this as a workaround if you want to
> avoid the validation.)
>
> Would it make sense to officially describe this in the exec(String[]),
> that you can specify the path to a bat/cmd file as the first argument
> and do not need to use the cmd /c?
>
Ideally all applications would quote correctly and avoid implicit 
execution of cmd.exe but there is a lot of existing code that doesn't. 
Some of the Oracle release notes and articles on this topic are here:

http://www.oracle.com/technetwork/java/javase/7u25-relnotes-1955741.html#jruntime

https://blogs.oracle.com/thejavatutorials/entry/changes_to_runtime_exec_problems

The javadoc isn't really the place for this amount of highly Windows 
specific detail. There may be a case of referencing implementation 
specific documentation, we have several areas where such references 
could be useful to supplement the API docs.

-Alan



More information about the core-libs-dev mailing list