After JDK is upgraded to, the built-in Tomcat of an application cannot be started, and an error "executable name has embedded quote" and "split the arguments" is reported.
After query, it is found that the runtime.exe C method has been changed for JDK 721and JDK 6u 45. The command with spaces may be affected.
Changes to runtime.exe C
On Windows platform, the decoding of command strings specified to runtime.exe C (string), runtime.exe C (string, string []) and runtime.exe C (string, string [], file) methods, has been improved to follow the specification more closely. this may cause problems for Applications
That are using one or more of these methods with commands that contain spaces in the program name, or are invoking these methods with commands that are not quoted correctly.
For example, runtime.getruntime(cmd.exe C ("C :\\ my Programs \ foo.exe bar") is an attempt to launch the program "C: \ My "with the arguments" Programs \ foo.exe "and" bar ". this command is likely to fail with an exception to indicate "C: \ My" cannot be found.
The example runtime.getruntime(cmd.exe C ("\" C :\\ my Programs \ foo.exe \ "bar") is an attempt to launch the program "\" C :\\ my ". this command will fail with an exception to indicate the program has an embedded quote.
Applications that need to launch programs with spaces in the program name shocould consider using the variants of runtime.exe C that allow the command and arguments to be specified in an array.
Alternatively, the preferred way to create operating systems processes since JDK 5.0 is using Java. lang. processbuilder. the processbuilder class has a much more complete API for setting the environment, working directory and redirecting streams for the process.
References
[1] Java SE Development Kit 6, update 45 (JDK 6u45) Update Release Notes. http://www.oracle.com/technetwork/java/javase/6u45-relnotes-1932876.html
[2] Java SE Development Kit 7, update 21 (JDK 72008) Update Release Notes. http://www.oracle.com/technetwork/java/javase/7u21-relnotes-1932873.html
[3] exec problem is JDK 1.7.0 _ 21. http://www.velocityreviews.com/forums/t959814-exec-problem-is-jdk-1-7-0_21-a.html